Code example for AccessControlContext

    private static final Logger disabledLogger = Logger.getLogger("disabled");
    private static AccessControlContext createLoggerControlAccCtxt() {
        final Permissions perms = new Permissions();
        perms.add(new LoggingPermission("control", null));
        return new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(null, perms) });
    static { 
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
            public Void run() {
                return null; 
        }, createLoggerControlAccCtxt()); 
    /** Maps logger name to loggers. Names are typically per package */ 
    private static final Map<String, Logger> loggers = new HashMap<>();
Connect your IDE to all the code out there  Get Codota for Java