Java Code Examples for java.util.logging.Logger#GLOBAL_LOGGER_NAME

The following examples show how to use java.util.logging.Logger#GLOBAL_LOGGER_NAME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAppletLoggerContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void testFour() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger1);
        assertNotNull(logger1b);
        assertEquals(logger1, logger1b);
        Bridge.changeContext();

        Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, logger2b);

        assertEquals(logger1, logger2);

        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
    }
}
 
Example 2
Source File: TestAppletLoggerContext.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void testFour() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger1);
        assertNotNull(logger1b);
        assertEquals(logger1, logger1b);
        Bridge.changeContext();

        Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, logger2b);

        assertEquals(logger1, logger2);

        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
    }
}
 
Example 3
Source File: TestAppletLoggerContext.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void testFour() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger1);
        assertNotNull(logger1b);
        assertEquals(logger1, logger1b);
        Bridge.changeContext();

        Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, logger2b);

        assertEquals(logger1, logger2);

        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
    }
}
 
Example 4
Source File: TestAppletLoggerContext.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void testFour() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger1);
        assertNotNull(logger1b);
        assertEquals(logger1, logger1b);
        Bridge.changeContext();

        Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, logger2b);

        assertEquals(logger1, logger2);

        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
    }
}
 
Example 5
Source File: TestAppletLoggerContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void testFour() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger1);
        assertNotNull(logger1b);
        assertEquals(logger1, logger1b);
        Bridge.changeContext();

        Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, logger2b);

        assertEquals(logger1, logger2);

        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
    }
}
 
Example 6
Source File: TestAppletLoggerContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void testFour() {
    for (int i=0; i<3 ; i++) {
        Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger1);
        assertNotNull(logger1b);
        assertEquals(logger1, logger1b);
        Bridge.changeContext();

        Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, logger2b);

        assertEquals(logger1, logger2);

        Bridge.changeContext();
        Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Bridge.changeContext();
        Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
    }
}
 
Example 7
Source File: TestAppletLoggerContext.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}
 
Example 8
Source File: TestAppletLoggerContext.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 9
Source File: TestAppletLoggerContext.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 10
Source File: TestAppletLoggerContext.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}
 
Example 11
Source File: TestAppletLoggerContext.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 12
Source File: TestAppletLoggerContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 13
Source File: TestAppletLoggerContext.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 14
Source File: TestAppletLoggerContext.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 15
Source File: TestAppletLoggerContext.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}
 
Example 16
Source File: TestAppletLoggerContext.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}
 
Example 17
Source File: TestAppletLoggerContext.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}
 
Example 18
Source File: TestAppletLoggerContext.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}
 
Example 19
Source File: TestAppletLoggerContext.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSeven() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger("");
        Logger logger1b = manager.getLogger("");
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        Logger logger3 = manager.getLogger("");
        Logger logger3b = manager.getLogger("");
        assertNull(logger3);
        assertNull(logger3b);
        Logger root = new Bridge.CustomLogger("");
        manager.addLogger(root);
        Logger logger4 = manager.getLogger("");
        Logger logger4b = manager.getLogger("");
        assertNotNull(logger4);
        assertNotNull(logger4b);
        assertEquals(logger4, root);
        assertEquals(logger4b, root);

        for (int j = 0 ; j < 3 ; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = (System.getSecurityManager() == null ? root : null);
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);

            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            } else {
                assertEquals(global, manager.getLogger(Logger.GLOBAL_LOGGER_NAME));
            }

            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger expectedGlobal = (System.getSecurityManager() == null ? global : global2);

            assertNotNull(logger6);
            assertNotNull(logger6b);
            assertEquals(logger6, expectedGlobal);
            assertEquals(logger6b, expectedGlobal);
            if (System.getSecurityManager() != null) {
                assertNull(manager.getLogger(""));
            } else {
                assertEquals(root, manager.getLogger(""));
            }

            Logger root2 = new Bridge.CustomLogger("");
            manager.addLogger(root2);
            expectedRoot = (System.getSecurityManager() == null ? root : root2);
            Logger logger7 = manager.getLogger("");
            Logger logger7b = manager.getLogger("");
            assertNotNull(logger7);
            assertNotNull(logger7b);
            assertEquals(logger7, expectedRoot);
            assertEquals(logger7b, expectedRoot);
        }
    }
}
 
Example 20
Source File: TestAppletLoggerContext.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * This test is designed to test the behavior of additional LogManager instances.
 * It must be noted that if the security manager is off, then calling
 * Bridge.changeContext() has actually no effect - which explains why we have
 * some differences between the cases security manager on & security manager
 * off.
 **/
public static void testSix() {
    for (int i=0; i<3 ; i++) {
        Bridge.desactivate();
        LogManager manager = new LogManager() {};
        Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNull(logger1);
        assertNull(logger1b);
        Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        manager.addLogger(global);
        Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        assertNotNull(logger2);
        assertNotNull(logger2b);
        assertEquals(logger2, global);
        assertEquals(logger2b, global);
        assertNull(manager.getLogger(""));
        assertNull(manager.getLogger(""));

        for (int j = 0; j<3; j++) {
            Bridge.changeContext();

            // this is not a supported configuration:
            // We are in an applet context with several log managers.
            // We however need to check our assumptions...

            // Applet context => root logger and global logger should also be null.

            Logger expected = (System.getSecurityManager() == null ? global : null);
            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertEquals(expected, logger3);
            assertEquals(expected, logger3b);
            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
            manager.addLogger(global2);
            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
            assertNotNull(logger4);
            assertNotNull(logger4b);
            expected = (System.getSecurityManager() == null ? global : global2);;
            assertEquals(logger4,  expected);
            assertEquals(logger4b, expected);

            Logger logger5 = manager.getLogger("");
            Logger logger5b = manager.getLogger("");
            Logger expectedRoot = null;
            assertEquals(logger5, expectedRoot);
            assertEquals(logger5b, expectedRoot);
        }

    }
}