LogRecord getLoggerName() method in Java with Examples Last Updated : 15 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 present else returns null. Below programs illustrate getLoggerName() method: Program 1: Java // Java program to illustrate getLoggerName() method import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object with a logger name LogRecord logRecord = new LogRecord( Level.parse("800"), "Hi Logger"); logRecord.setLoggerName("StringLogger"); // get Logger Name of LogRecord String name = logRecord.getLoggerName(); // print result System.out.println("Logger Name = " + name); } } Output: Logger Name = StringLogger Program 2: Java // Java program to illustrate getLoggerName() method import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object with a logger name LogRecord logRecord = new LogRecord( Level.parse("400"), "GFG Logger"); logRecord.setLoggerName(String.class.toString()); // get Logger Name of LogRecord String name = logRecord.getLoggerName(); // print result System.out.println("Logger Name = " + name); } } Output: Logger Name = class java.lang.String References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/LogRecord.html#getLoggerName() Comment More infoAdvertise with us Next Article LogManager getLoggerNames() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-LogRecord java.util.logging package 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 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 LogRecord getLevel() method in Java with Examples The getLevel() method of java.util.logging.LogRecord is used to get the logging message level of this current LogRecord object, for example Level.Info. Syntax: public Level getLevel() Parameters: This method accepts nothing. Return: This method returns the logging message level. Below programs illus 1 min read LogRecord getMessage() method in Java with Examples The getMessage() method of java.util.logging.LogRecord is used to get the actual log message, before localization or formatting from this logRecord.This message may be null, which is equivalent to the empty string "". This returned message may be either the final text or a localization key. Syntax: 2 min read LogRecord getSourceClassName() method in Java with Examples The getSourceClassName() method of java.lang.reflect.LogRecord is used to get the name of the class that allegedly issued the logging request. The source class name which is used in logRecord for logging purpose. Syntax: public String getSourceClassName() Parameters: This method accepts nothing. Ret 1 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