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. 回答1: You could try something like: Enumeration allLoggers = Logger.getRootLogger() .getLoggerRepository() .getCurrentLoggers(); Then iterate over allLoggers. 回答2: to get the loggers use one of these Logger