I have been working a bit with log4net and have been inserting extra fields, but I have problems with adding int fields. Could anyone show a configuration where an int is used, since I have not been able to find it on their homepage.
I normally just use a configuration like:
<parameter>
<parameterName value="@orderid" />
<dbType value="string" />
<size value="64" />
<layout type="log4net.Layout.PatternLayout" />
</parameter>
But it would be more optimal for searching in the log database if this field could have been an int instead.
Just changing it to Int32 did not fix the issue for me. For others looking to solve this problem, here's the solution:
<parameter>
<parameterName value="@UserID" />
<dbType value="Int32" />
<size value="32" />
<layout type="log4net.Layout.RawPropertyLayout">
<key value="UserID" />
</layout>
</parameter>
This will also deal with NULLs
The dbType property is of type System.Data.DbType. There, you can use the Int32 value to represent integers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With