Logger getGlobal() Method in Java with Examples Last Updated : 22 Mar, 2019 Comments Improve Suggest changes Like Article Like Report getGlobal() method of a Logger class is used to get global logger object with the name Logger.GLOBAL_LOGGER_NAME.The "global" Logger object is helpful for developers who are making casual use of the Logging package. For making serious use of the logging package developers have to create and use their own Logger objects, with appropriate names, so that logging can be controlled on a suitable per-Logger granularity. At the time of logging in an application, more granular loggers are defined, usually per Java packages or classes. If you do not want to define longer per Java packages or classes, you can use this global logger, which will handle all logging statements, no matter the library, package or class they are contained in. Syntax: public static final Logger getGlobal() Parameters: This method accepts nothing. Return value: This method return global logger object. Below programs illustrate the getGlobal() method: Program 1: Java // Java program to demonstrate // Logger.getGlobal() method import java.util.logging.*; public class GFG { public static void main(String[] args) { // Create a logger using getGLobal() Logger logger = Logger.getGlobal(); logger.info("THIS IS MESSAGE ONE"); logger.info("THIS IS MESSAGE TWO"); } } Output: The output printed on eclipse IDE shown below- Program 2: Java // Java program to demonstrate // Logger.getGlobal() method import java.util.logging.*; public class GFG { // Create a logger using getGLobal() static Logger logger = Logger.getGlobal(); public static void main(String[] args) { logger.info("THIS IS MESSAGE ONE"); method1(); method2(); } public static void method1() { logger.info("THIS IS MESSAGE TWO"); } public static void method2() { logger.info("THIS IS MESSAGE THREE"); } } Output: The output printed on eclipse IDE shown below- Reference: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Logger.html#getGlobal() Comment More infoAdvertise with us Next Article Logger getGlobal() Method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java 8 Java-Logger Practice Tags : Java Similar Reads Logger getLevel() method in Java with Examples The getLevel() method of the Logger class in Java is used to get the log Level that has been specified for this Logger instance. Every Logger has specific log levels and if the result is null, which means that this logger's effective level will be inherited from its parent. Log Levels: The log level 2 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 Logger getHandler() Method in Java with Examples The getHandlers() method of the Logger class is used to get the Handlers linked with this logger. Handler is used to taking care of the actual logging. one or more Handler can be added to a Logger. When messages are logged via the Logger, the messages are forwarded to the Handler. This method is hel 2 min read Logger exiting() method in Java with Examples The exiting() method of a Logger class used to Log a method return. There are two types of exiting() method depending upon the parameters passed. exiting(String sourceClass, String sourceMethod): This method is used to Log a method return. we need to log what method returns and this is a convenience 3 min read Like