log4j ConversionPattern时间戳(以微秒为单位) [英] log4j ConversionPattern timestamp with microseconds
问题描述
我想在用log4j生成的日志文件的每个条目的时间戳中添加微秒,这可能吗?
I want to add microseconds in the timestamp of each entry of my log files generated with log4j, is it possible ?
我已经搜索了官方文档,但没有提到毫秒以下的单位.
I have searched in the official documentation but there are no mention of unit below the milliseconds.
现在,我有一个类似于以下的转换模式:
Now i have a conversion pattern like the following :
%d{dd/MM/yyyy HH\:mm\:ss,SSS} %-5p [%t] - %m%n
在日期转换模式(%d )中,我想在毫秒值( SSS )之后添加 microseconds ,有没有办法去做吧 ?
in the date conversion pattern(%d) i want to add microseconds after the milliseconds value(SSS), is there a way to do it ?
推荐答案
如果要显示微秒,则需要自己添加.可以使用自定义的Formatter(而不是PatternFormatter)完成
If you want to display micro-seconds, you need to add this yourself. This could be done with a custom Formatter (instead of PatternFormatter)
这篇关于log4j ConversionPattern时间戳(以微秒为单位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!