Java – log4j conversionpattern timestamp in microseconds

I want to add microseconds to the timestamp of each entry in the log file generated by log4j. Is it possible?

I searched in the official documents, but did not mention units below milliseconds

Now I have a conversion mode as follows:

%d{dd/MM/yyyy HH\:mm\:ss,SSS} %-5p [%t] - %m%n

In date conversion mode (% d), I want to add microseconds after milliseconds (SSS). Is there any way to do this?

Solution

If you want to display microseconds, you need to add them yourself This can be done using a custom formatter instead of a patternformatter

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>