Check out example codes for "logger in java". It will help you in understanding the concepts better.

Code Example 1

// Java program to illustrate logging in Java 
// The following code shows a basic example how logging  
// works in Java 
import java.util.logging.Level; 
import java.util.logging.Logger; 
import java.util.logging.*; 
class DemoLogger { 
    private final static Logger LOGGER =  
    // Get the Logger from the log manager which corresponds  
    // to the given name <Logger.GLOBAL_LOGGER_NAME here> 
    // static so that it is linked to the class and not to 
    // a particular log instance because Log Manage is universal 
    public void makeSomeLog() 
        // add some code of your choice here 
        // Moving to the logging part now 
        LOGGER.log(Level.INFO, "My first Log Message"); 
        // A log of INFO level with the message "My First Log Message" 
public class GfG { 
    public static void main(String[] args) 
        DemoLogger obj = new DemoLogger(); 
        // Generating some log messages through the  
        // function defined above 
        LogManager lgmngr = LogManager.getLogManager(); 
        // lgmngr now contains a reference to the log manager. 
        Logger log = lgmngr.getLogger(Logger.GLOBAL_LOGGER_NAME); 
        // Getting the global application level logger  
        // from the Java Log Manager 
        log.log(Level.INFO, "This is a log message"); 
        // Create a log message to be displayed 
        // The message has a level of Info 

Code Example 2

Logging is the process of writing log messages during the execution of a 
program to a central place.This logging allows you to report and persist
error and warning messages as well as info messages (e.g., runtime 
statistics) so that the messages can later be retrieved and analyzed.

Learn ReactJs, React Native from