Logging displaying the wrong time in the time stamp

Topics: Logging Application Block
Dec 6, 2010 at 3:38 PM


I am using the Microsoft.Practices.EnterpriseLibrary.Logging and I am having trouble with the TimeStamp displaying the incorrect time.  This is the code I have:


 <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
      <add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Text Formatter"/>



However, the timestamp is displaying the time 5 hours ahead of what the time is.  How do I fix this?



Dec 6, 2010 at 11:14 PM

It displays the UTC time.  To display the time on your machine, use the token {timestamp(local} instead of {timestamp} in your formatter.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Dec 6, 2010 at 11:21 PM

This is great, thank you so much for your help!!!