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<>();
Stop searching for code, let great code find you!  Add Codota to your java IDE