LogRecord getSourceMethodName() method in Java with Examples Last Updated : 23 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The getSourceMethodName() method of java.lang.reflect.LogRecord is used to get the name of the method that allegedly issued the logging request. The source method which is used in logRecord for logging purpose. Syntax: public String getSourceMethodName() Parameters: This method accepts nothing. Return: This method returns the source method name. Below programs illustrate getSourceMethodName() method: Program 1: Java // Java program to illustrate // getSourceMethodName() method import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object LogRecord logRecord = new LogRecord( Level.parse("800"), "Hi Logger"); logRecord.setSourceMethodName( "MyFirstSourceMethod"); // get the source method name String sourceMethod = logRecord.getSourceMethodName(); // print the method name System.out.println( "Source Method Name = " + sourceMethod); } } Output: Source Method Name = MyFirstSourceMethod Program 2: Java // Java program to illustrate // getSourceMethodName() method import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.*; public class GFG { public static void main(String[] args) { // Create LogRecord object LogRecord logRecord = new LogRecord( Level.parse("600"), "GFG Logger"); logRecord.setSourceMethodName( ArrayList .class .getMethods()[0] .getName()); // get the source method name String sourceMethod = logRecord.getSourceMethodName(); // print the method name System.out.println( "Source Method Name = " + sourceMethod); } } Output: Source Method Name = add References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/LogRecord.html#getSourceMethodName() Comment More infoAdvertise with us Next Article LogRecord getSourceMethodName() 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 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 LogRecord getResourceBundleName() method in Java with Examples The getResourceBundleName() method of java.lang.reflect.LogRecord is used to get the localization resource bundle name. Syntax: public String getResourceBundleName() Parameters: This method accepts nothing. Return: This method returns the localization resource bundle name. Below programs illustrate 1 min read LogRecord getResourceBundle() method in Java with Examples The getResourceBundle() method of java.lang.reflect.LogRecord is used to get the localization resource bundle.Resource bundle used to localize the message of this LogRecord. Syntax: public ResourceBundle getResourceBundle() Parameters: This method accepts nothing. Return: This method returns the loc 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 LogRecord getThrown() method in Java with Examples The getThrown() method of java.lang.reflect.LogRecord is used to get a throwable associated with the log event.This is used to log Exceptions in the logRecord that can be used for logging messages. Syntax: public Throwable getThrown() Parameters: This method accepts nothing. Return: This method retu 1 min read Like