LogManager getLoggerNames() method in Java with Examples Last Updated : 29 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The getLoggerNames() method of java.util.logging.LogManager is used to get a list of known logger names. This method returns this list in the form of an Enumeration object. Syntax: public Enumeration getLoggerNames() Parameters: This method does not accepts any parameter. Return Value: This method returns list of known logger names list in the form of an Enumeration object. Below programs illustrate getLoggerNames() method: Program 1: Java // Java program to illustrate // LogManager getLoggerNames() method import java.util.logging.*; import java.util.*; public class GFG { public static void main(String[] args) { // Create LogManager object LogManager logManager = LogManager.getLogManager(); Enumeration<String> listOfNames = logManager.getLoggerNames(); System.out.println("List of Logger Names: "); while (listOfNames.hasMoreElements()) System.out.println(listOfNames.nextElement()); } } Output: List of Logger Names: global Program 2: Java // Java program to illustrate // LogManager getLoggerNames() method import java.util.logging.*; import java.util.*; public class GFG { public static void main(String[] args) { // Create LogManager object LogManager logManager = LogManager.getLogManager(); logManager.addLogger(Logger.getLogger("GFG")); Enumeration<String> listOfNames = logManager.getLoggerNames(); System.out.println("\nList of Logger Names: "); while (listOfNames.hasMoreElements()) System.out.println(listOfNames.nextElement()); } } Output: List of Logger Names: GFG global Reference: https://docs.oracle.com/javase/9/docs/api/java/util/logging/LogManager.html#getLoggerNames-- Comment More infoAdvertise with us Next Article LogManager getLoggerNames() method in Java with Examples G guptayashgupta53 Follow Improve Article Tags : Java Java-Functions java.util.logging package Java-LogManager Practice Tags : Java Similar Reads LogManager getLogger() method in Java with Examples The getLogger() method of java.util.logging.LogManager is used to get the specified Logger in this LogManager instance. This Logger must be a named Logger. This method will get this Logger in this LogManager if it exists. If it does not exists, then this method returns null. Syntax: public Logger ge 2 min read LogManager getLogManager() method in Java with Examples The getLogManager() method of java.util.logging.LogManager is used to get the global LogManager object Syntax: public static LogManager getLogManager() Parameters: This method does not accepts any parameter. Return Value: This method returns the global LogManager object. Below programs illustrate ge 1 min read LogRecord getLoggerName() method in Java with Examples The getLoggerName() method of java.util.logging.LogRecord is used to get the logger name of source.This method returns source logger name if present else returns null. Syntax: public String getLoggerName() Parameters: This method accepts nothing. Return: This method returns source logger name if pre 1 min read Logger getLogger() Method in Java with Examples The getLogger() method of a Logger class used find or create a logger. If there is a logger exists with the passed name then the method will return that logger else method will create a new logger with that name and return it. There are two types of getLogger() method depending upon no of the parame 4 min read Logger getName() Method in Java with Examples getName() method of a Logger class used to get the name of logger. Many times you have to check the logger name so we can use this method to get the logger name. Syntax: public String getName() Parameters: This method accepts nothing. Return value: This method return logger name and it will be null 1 min read Like