LogManager reset() method in Java with Examples

The reset() method of java.util.logging.LogManager is used to reset the logging configuration. This method throws SecurityException if the exception condition occurs, as given below


public void reset() throws SecurityException

Parameters: This method does not accepts any parameter.

Return Value: This method does not return anything. It just resets the logging configuration.

Exceptions: This method throws following exceptions:

  • SecurityException: if a security manager exists while the caller does not have logging permissions.

Below programs illustrate reset() method:





// Java program to illustrate
// LogManager reset() 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("Resetting the logging configuration");
            // Resetting the logging configuration
            // using reset() method
        catch (Exception e) {



LogManager: java.util.logging.LogManager@1540e19d
Resetting the logging configuration
 access denied ("java.util.logging.LoggingPermission" "control")

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.