Timestamp in local timezone (not just formatted message)

Topics: Logging Application Block, Policy Injection Application Block
May 20, 2008 at 7:40 PM
Edited May 20, 2008 at 7:52 PM
I know this has been asked before, but I don't think in quite this way.

I have some categories that log both to a database and to the event log.  I am using timestamp(local) but that only changes the time on the formatted message.  The database formatter has its own timestamp field that is still in UTC.  I would really prefer not to change the proc to just have getdate() because the timestamps may not be exacly the same.  Is there a way to change this value at its root so that the database logger will have the correct timestamp.  I apologize of this has been answered before, but I didn't see any entries with this exact question.

Also, are there any tokens available for the beforeMessage and afterMessage that I can use when using the logging handler via policy injection.  I would like the title and/or message to have the type and method name.  I have tried {method} or {property(MethodName)}.  Neither seem to work.

Oct 8, 2008 at 10:36 PM


I had the same problem. I dug through the EL code and couldn't find any code allowing configuration of the Entry.TimeStamp.  I had to change the WriteLog stored procedure to covert the parameter to local time. Wish somebody could have replied this. Why always UTC?

DATEADD(minute,DATEDIFF(minute,GETUTCDATE(),GETDATE()),@Timestamp), -- Convert to local time.