Java – number of recorders used

I am working with a very large Java application using log4j, and I wonder if there is a way to extract the number of active recorders at run time? Or what are the existing recorders in the application?

Solution

You can try something similar:

Enumeration allLoggers = Logger.getRootLogger()
.getLoggerRepository()
.getCurrentLoggers();

Then iterate through allloggers

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
分享
二维码
< <上一篇
下一篇>>