Share via


EntLib logging, with local date time not GMT

 

Ετικέτες Technorati: Enterprise Library

If you use Enterprise Library for logging in your application (you should be using it), then you should know that by default the date/time that is being logged is in GMT time zone, not in your machine’s local time zone. All you have to do in order to log entries in your local time zone is changing the .config file of yours in the FORMATTERS section, open the .config file with the EntLib configuration editor, click on your formatter (the default is Text Formatter) and then click the ellipsis button in the “Template” property in the Properties toolbox,

image

Change the Timestamp: {timestamp} to Timestamp: {timestamp(local)}.

image

That’s all there is to it.

Comments

  • Anonymous
    March 07, 2009
    PingBack from http://www.clickandsolve.com/?p=19358

  • Anonymous
    September 17, 2010
    Thanks.  This is especially nice for a local rolling log file where looking at GMT only confuses me.  For logging to a database, you could still use a formatter which employs {timestamp} if GMT is required.