Using the Windows timezone for Enterprise Library logging formatters.

By default entlib uses GMT time for timestamps. If you're in New Zealand this means the timestamps on your log entries are all incorrect.  This is something that I always forget how to do but it is very easy to correct. If you have a text formatter that looks similar to: 

<formatters>
     <add template="Timestamp: {timestamp}&#xD;&#xA;
     Message: {message}&#xD;&#xA;
     Category: {category}&#xD;&#xA;)}"
     type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
     Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral,
     PublicKeyToken=b03f5f7f11d50a3a" name="Text Formatter" />
</formatters>


You simply need to change the {timestamp} to {timestamp(local)} and it will use the server timezone. Easy.

Tags: , ,

Comments

trackback
DotNetKicks.com
10/25/2010 11:51:36 PM Permalink

Using the Windows timezone for Enterprise Library logging formatters.

You've been kicked (a good thing) - Trackback from DotNetKicks.com

trackback
DotNetHeaven.Net
10/27/2010 4:20:49 AM Permalink

instantiate | Using the Windows timezone for Enterprise Library logging formatters.

Thank you for submitting this cool story - Trackback from DotNetHeaven.Net

trackback
DotNetShoutout
10/29/2010 12:05:32 PM Permalink

instantiate | Using the Windows timezone for Enterprise Library logging formatters.

Thank you for submitting this cool story - Trackback from DotNetShoutout

cialis
cialis Turkmenistan
5/13/2012 3:16:43 PM Permalink

I have unit converter pages online, would you please be interested in placing my website's link (code below) on your page with the unit conversion tables? Thank you very much.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading