What is log4net.Layout.PatternLayout value to output DateTimeOffset data type to database?
This is what I have currently in configuration file for log4net:
<log4net>
....
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
</parameter>
...
</log4net>
And I want to have something like:
<log4net>
....
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTimeOffset" />
<layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff **OFFSET**}" />
</parameter>
...
</log4net>
Basically we reuse the same DB to log events from clients located in different time zones - so we want to know an exact local time of the event.
Thanks, Alex
You should be able to use any valid DateTime format string. Try this:
%date{yyyy-MM-ddTHH:mm:ss.fffzzz}
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