locked
Help to change the format of timestamp in logging application block RRS feed

  • Question

  •  

    Hello,
    I have a log file that is currently in the default format of

    add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}"

     

     

     is there any way I can change the format of my log file to look like this:

    [INFO ][2008-09-10 16:24:01,504][ContextImpl] 

    I did figure out how to change the time to reflect my local time instead of UTC by writing my custom class, however I dont know how to set the formatted (string) time back to the log file's timestamp.


    Any help will be appreciated.
    Thanks

     

    Wednesday, September 24, 2008 6:48 PM

All replies

  • Hi, Sorry I saw the blog only now Sad

     

    To change the timestamp to reflect the local server time, in a particular format use the following example:

     

    Timestamp: {timestamp(local:yyyy-MM-dd HH:mmTongue Tieds.fff)}

     

    The important section is within the brackets. The string "local" denotes local server time, and the format string must be specified after the ":" character. In the above case that translates to "yyyy-MM-dd HH:mmTongue Tieds.fff". In my case I am displaying time in milliseconds.

     

     

    Hope this helps...

     

     

    Thankx

    Thursday, January 1, 2009 12:50 PM
  • Hi,

     

    Can you please provide me the timestamp format to include millisecond ?

     

    Thanks

    Mitesh Patel

    Thursday, May 27, 2010 1:18 PM