Time Stamp in the Required time Zone in Logger Application block

Topics: Logging Application Block
Aug 31, 2009 at 11:10 AM

Hi

My Db server  & webserver are in different time zones. I would like to log all the entries with Db server time zone. How to mention specific time zone

in logger application block. Please send me the sample entry for (GMT-04:30)Atlantic Time(Canada).

Thanks in Advance

PVASN Murthy

 

 

Sep 1, 2009 at 2:20 AM

You can configure LAB to use the UTC (which is the default) or the Local timezone.  But it wouldn't know about the timezone of your DB server.  What you can do is modify the WriteLog stored procedure to just ignore the timestamp parameter and use the currentdate instead.  However, the Message and FormattedMessage column will still have the your webserver's timestamp info.  The other way I could think of is to create a custom database tracelistener and implement the logic of getting the timezone you want for the TimeStamp info.  Here is a link on how to convert dates to different timezone - http://www.xiirus.net/articles/article-_net-convert-datetime-from-one-timezone-to-another-7e44y.aspx

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com