开发者

Wrong timestamp in log4j XMLLayout

开发者 https://www.devze.com 2023-01-01 04:55 出处:网络
I set my log4j configuration to use two appenders (ConsoleAppender and RollingFileAppender) the ConsoleAppender is using this layout (PatternLayout: ConversionPattern=%d [%t] %-5p %c - %m%n) and the R

I set my log4j configuration to use two appenders (ConsoleAppender and RollingFileAppender) the ConsoleAppender is using this layout (PatternLayout: ConversionPattern=%d [%t] %-5p %c - %m%n) and the RollingFileAppender is using XMLLayout. So the problem is that the ConsoleAppender output is displaying the c开发者_Go百科orrect date when I log an error, let's say "05/28/2010 12:45 PM" but the XMLLayout timestamp attribute is being set 5 hours into the future, when I convert that epoch value to DateTime I got "05/28/2010 5:45 PM". I even used http://www.epochconverter.com/ to check if my conversion algorithm was wrong and the result was the same. Any idea why is this happening?

Thanks


Sounds like one conversion is respecting UTC offset and one (the one in the future) is not. You're in the EDT timezone, correct?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号