Thursday, January 22, 2026
HomeLanguagesJavaLogManager readConfiguration() method in Java with Examples

LogManager readConfiguration() method in Java with Examples

The readConfiguration() method of java.util.logging.LogManager is used to read and initialize the default configuration. This method throws IOException and SecurityException if the exception condition occurs, as given below
 

Syntax:  

public void readConfiguration()
  throws IOException, SecurityException

Parameters: This method does not accepts any parameter.
Return Value: This method does not return anything. It just reads and initializes the logging configuration.
Exceptions: This method throws following exceptions:  

  • IOException: if any IO error occurs while reading the configuration.
  • SecurityException: if a security manager exists while the caller does not have logging permissions.

Below programs illustrate readConfiguration() method: 

Java




// Java program to illustrate
// LogManager readConfiguration() method
 
import java.util.logging.*;
import java.util.*;
 
public class GFG {
 
    public static void main(String[] args)
    {
 
        try {
            // Create LogManager object
            LogManager logManager
                = LogManager.getLogManager();
 
            System.out.println("LogManager: "
                               + logManager);
 
            System.out.println(
                "Reading the configuration "
                + "using readConfiguration() method");
            logManager.readConfiguration();
        }
        catch (Exception e) {
            System.out.println(e);
        }
    }
}


Output: 
LogManager: java.util.logging.LogManager@1540e19d 
Reading the configuration using readConfiguration() method 
java.security.AccessControlException: access denied (“java.util.logging.LoggingPermission” “control”) 
 

Reference: https://docs.oracle.com/javase/9/docs/api/java/util/logging/LogManager.html#readConfiguration–
 

RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6934 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS