0
这里是我的服务器我看到当前的记录:如何包括log4j配置日期
12:40:10,190 | INFO | -549263035-19951 | ServiceImpl | Upload started
12:40:12,912 | INFO | -549263035-19960 | ServiceImpl | Upload started
12:40:12,915 | INFO | -549263035-19958 | ServiceImpl | Upload started
My application is using log4j to implement logging. here is the log4j.properties file which is sitting inside META-INF.
log4j.rootCategory=DEBUG, O
log4j.appender.O=org.apache.log4j.ConsoleAppender
log4j.appender.O.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
As we can clearly see, current logging has the time information for every event. I wanted to know if there is a way I could make some changes in this properties file or elsewhere to include the full timestamp i.e. Date and time both.
类似: 2013年7月18日12时40分十二秒| INFO | -549263035-19958 | ServiceImpl |开始上传
Thanks for suggestion.
我有感觉,你的记录器消息使用的不是你发布的布局,你能否以某种方式改变你的模式(例如删除[%d {ISO8601}]),并确保你的记录输出会改变。 – nkukhar
我经历了文档,看起来你是对的,我的日志不使用这种布局。因为%d后跟ISO8601也应该记录日期。我假设我部署此应用程序的服务器使用的是优先于它的不同日志记录方案。但我不知道如何解决这个问题。 – Ashish
thanx为您的输入 – Ashish