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