Skip to content
Related Articles
Open in App
Not now

Related Articles

LogManager checkAccess() method in Java with Examples

Improve Article
Save Article
  • Last Updated : 29 Oct, 2019
Improve Article
Save Article

The checkAccess() method of java.util.logging.LogManager is used to check if this context has the permissions to modify the logging configuration, which requires LoggingPermission(“control”). This method throws SecurityException if the exception condition occurs, as given below


public void checkAccess()
  throws SecurityException

Parameters: This method does not accepts any parameter.

Return Value: This method does not return anything. It just checks if this context has the permissions to modify 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 checkAccess() method:

// Java program to illustrate
// LogManager checkAccess() 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);
                "Checking for permissions\n");
            // Checking for permissions
            // using checkAccess() method
        catch (SecurityException e) {
            System.out.println("Permission Denied");


LogManager: java.util.logging.LogManager@1540e19d
Checking for permissions

Permission Denied


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!