Java Code Examples for sun.util.logging.PlatformLogger#setLevel()

The following examples show how to use sun.util.logging.PlatformLogger#setLevel() . 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: PlatformLoggerTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 2
Source File: PlatformLoggerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 3
Source File: PlatformLoggerTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 4
Source File: PlatformLoggerTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 5
Source File: PlatformLoggerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 6
Source File: PlatformLoggerTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 7
Source File: PlatformLoggerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 8
Source File: PlatformLoggerTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 9
Source File: PlatformLoggerTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkPlatformLogger(PlatformLogger logger, String name) {
    if (!logger.getName().equals(name)) {
        throw new RuntimeException("Invalid logger's name " +
            logger.getName() + " but expected " + name);
    }

    if (logger.level() != null) {
        throw new RuntimeException("Invalid default level for logger " +
            logger.getName() + ": " + logger.level());
    }

    checkLoggable(logger, FINE, false);

    logger.setLevel(FINER);
    checkLevel(logger, FINER);
    checkLoggable(logger, FINER, true);
    checkLoggable(logger, FINE, true);
    checkLoggable(logger, FINEST, false);

    logger.info("OK: Testing log message");
}
 
Example 10
Source File: PlatformLoggerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 11
Source File: PlatformLoggerTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 12
Source File: PlatformLoggerTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 13
Source File: PlatformLoggerTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 14
Source File: PlatformLoggerTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 15
Source File: PlatformLoggerTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 16
Source File: PlatformLoggerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 17
Source File: PlatformLoggerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 18
Source File: PlatformLoggerTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 19
Source File: PlatformLoggerTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}
 
Example 20
Source File: PlatformLoggerTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
    final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
    final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
    final String BAR_LOGGER = "test.logger.bar";
    PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
    // test the PlatformLogger methods
    testLogMethods(goo);

    // Create a platform logger using the default
    PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
    checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);

    // create a java.util.logging.Logger
    // now java.util.logging.Logger should be created for each platform logger
    Logger logger = Logger.getLogger(BAR_LOGGER);
    logger.setLevel(Level.WARNING);

    PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
    checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);

    // test the PlatformLogger methods
    testLogMethods(goo);
    testLogMethods(bar);

    checkLogger(FOO_PLATFORM_LOGGER, Level.FINER);
    checkLogger(BAR_PLATFORM_LOGGER, Level.FINER);

    checkLogger(GOO_PLATFORM_LOGGER, null);
    checkLogger(BAR_LOGGER, Level.WARNING);

    foo.setLevel(PlatformLogger.Level.SEVERE);
    checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE);

    checkPlatformLoggerLevels(foo, bar);
}