24 */ 25 26 package java.util.logging; 27 28 import java.util.Enumeration; 29 import java.util.List; 30 import java.util.ArrayList; 31 32 /** 33 * Logging is the implementation class of LoggingMXBean. 34 * 35 * The <tt>LoggingMXBean</tt> interface provides a standard 36 * method for management access to the individual 37 * java.util.Logger objects available at runtime. 38 * 39 * @author Ron Mann 40 * @author Mandy Chung 41 * @since 1.5 42 * 43 * @see javax.management 44 * @see java.util.Logger 45 * @see java.util.LogManager 46 */ 47 class Logging implements LoggingMXBean { 48 49 private static LogManager logManager = LogManager.getLogManager(); 50 51 /** Constructor of Logging which is the implementation class 52 * of LoggingMXBean. 53 */ 54 Logging() { 55 } 56 57 public List<String> getLoggerNames() { 58 Enumeration loggers = logManager.getLoggerNames(); 59 ArrayList<String> array = new ArrayList<>(); 60 61 for (; loggers.hasMoreElements();) { 62 array.add((String) loggers.nextElement()); 63 } 64 return array; 65 } | 24 */ 25 26 package java.util.logging; 27 28 import java.util.Enumeration; 29 import java.util.List; 30 import java.util.ArrayList; 31 32 /** 33 * Logging is the implementation class of LoggingMXBean. 34 * 35 * The <tt>LoggingMXBean</tt> interface provides a standard 36 * method for management access to the individual 37 * java.util.Logger objects available at runtime. 38 * 39 * @author Ron Mann 40 * @author Mandy Chung 41 * @since 1.5 42 * 43 * @see javax.management 44 * @see Logger 45 * @see LogManager 46 */ 47 class Logging implements LoggingMXBean { 48 49 private static LogManager logManager = LogManager.getLogManager(); 50 51 /** Constructor of Logging which is the implementation class 52 * of LoggingMXBean. 53 */ 54 Logging() { 55 } 56 57 public List<String> getLoggerNames() { 58 Enumeration loggers = logManager.getLoggerNames(); 59 ArrayList<String> array = new ArrayList<>(); 60 61 for (; loggers.hasMoreElements();) { 62 array.add((String) loggers.nextElement()); 63 } 64 return array; 65 } |