I'm working on a very large java application with log4j, and I was wondering if there is a way to extract in runtime the number of active loggers? Or what are the existing loggers in the application? My end goal is to get a list of all loggers and change their level in runtime. Thank you.
You could try something like:
Enumeration allLoggers = Logger.getRootLogger()
.getLoggerRepository()
.getCurrentLoggers();
Then iterate over allLoggers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With