americanslon
americanslon

Reputation: 4288

log4j/log4net set the time stamp to eastern time zone

I have an app that runs on azure. Azure uses UTC time for their date related stuff so all the log entries have "incorrect" times.

How can I change the log4net config file so the timestamps get recorded as eastern time zone?

My current pattern

<layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="[%date{dd MMM yyyy HH:mm:ss.fffzzz}] [%5level] (%identity-%username) %message%newline" />
  </layout>

Upvotes: 0

Views: 1938

Answers (1)

ervidio
ervidio

Reputation: 591

You can add the timezone to your conversionPattern, for example:

<layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="[%d{dd MMM yyyy HH:mm:ss.fffzzz}{GMT}] [%5level] (%identity-%username) %message%newline" />
  </layout>

You can check the layout here

Upvotes: 2

Related Questions