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,


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


That’s all there is to it.