开发者

Log4J; how to ensure timestamps are always in GMT using ConversionPattern?

开发者 https://www.devze.com 2023-01-14 21:53 出处:网络
How can I ensure that all timestamps that my log4j is using, are in GMT? I have tried the following but it prints \"GMT\" inside the timestamp

How can I ensure that all timestamps that my log4j is using, are in GMT?

I have tried the following but it prints "GMT" inside the timestamp

log4j.appender.ConversionPattern=%d{HH\:mm\:ss,SSS}{GMT} %-4r %-5p 开发者_Python百科[%t] %3x - %m%n


I have log4j-1.2.16 and the following lines work properly:

log4j.appender.A1.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601}{GMT} [%-5p] [%t] [%F:%L] - %m%n

If it doesn't work, then you have to download extras (companios section). This package contains EnhancedPatternLayout: Download apache-log4j-extras

0

精彩评论

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