LogManager getLogger() method in Java with Examples Last Updated : 29 Oct, 2019 Comments Improve Suggest changes Like Article Like Report 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 getLogger(Logger logger) Parameters: This method accepts a parameter logger which is the name of the Logger to be get in this LogManager instance. Return Value: This method returns the name of this Logger in this LogManager if it exists. If it does not exists, then this method returns null. Below programs illustrate getLogger() method: Java // Java program to illustrate // LogManager getLogger() method import java.util.logging.*; import java.util.*; public class GFG { public static void main(String[] args) { // Create LogManager object LogManager logManager = LogManager.getLogManager(); String LoggerName = "GFG"; Logger logger = Logger.getLogger(LoggerName); logManager.addLogger(logger); System.out.println("\nList of Logger Names: "); Enumeration<String> listOfNames = logManager.getLoggerNames(); while (listOfNames.hasMoreElements()) System.out.println(listOfNames.nextElement()); System.out.println( "\nGet Logger Name " + LoggerName + ": " + logManager.getLogger(LoggerName)); LoggerName = "Geeks"; System.out.println( "\nGet Logger Name " + LoggerName + ": " + logManager.getLogger(LoggerName)); } } Output: List of Logger Names: GFG global Get Logger Name GFG: java.util.logging.Logger@1540e19d Get Logger Name Geeks: null Reference: https://docs.oracle.com/javase/9/docs/api/java/util/logging/LogManager.html#getLogger-java.lang.String- Comment More infoAdvertise with us Next Article LogManager getLogger() 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 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 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 LogManager getLoggerNames() method in Java with Examples 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 r 1 min read LogManager getProperty() method in Java with Examples The getProperty() method of java.util.logging.LogManager is used to get the value of the specified propertyName in this LogManager instance. This method will get this property in this LogManager if it exists. If it does not exists, then this method returns null. Syntax: public String getProperty(Str 1 min read Logger getFilter() Method in Java with Examples The getFilter() method of the Logger class is used to get the current filter for this Logger instance. A Filter is useful to filter out log messages. we can say that filter decide the message gets logged or not. Filters are represented by the Java interface java.util.logging.Filter Syntax: public Fi 2 min read Like