Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of loggers used

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.

like image 740
MichalK Avatar asked Nov 17 '11 15:11

MichalK


1 Answers

You could try something like:

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

Then iterate over allLoggers.

like image 167
Andres Olarte Avatar answered Oct 16 '22 15:10

Andres Olarte