0

这是我在服务器中看到的当前日志记录:

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-07-18 12:40:12 | 信息 | -549263035-19958 | 服务实现 | 上传开始

Thanks for suggestion.
4

1 回答 1

0

找到了我的答案。此应用程序部署在 Servicemix 容器中。显然在 servicemix 的安装目录中,我找到了这个配置文件。“/usr/local/servicemix/etc/org.ops4j.pax.logging.cfg”。

在这个文件中,有一个使用 %d[ABSOLUTE] 作为转换模式的 SiftingAppender。所以基本上每个在 servicemix 下部署的包都将使用这个“siftingappender”属性。我刚刚从这个配置文件中删除了 [ABSOLUTE] 并开始在我的日志中获取日期。

于 2013-07-19T19:31:13.787 回答