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

The following examples show how to use sun.util.logging.PlatformLogger#severe() . 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: HijrahChronology.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * For each Hijrah variant listed, create the HijrahChronology and register it.
 * Exceptions during initialization are logged but otherwise ignored.
 */
private static void registerVariants() {
    for (String name : calendarProperties.stringPropertyNames()) {
        if (name.startsWith(PROP_PREFIX)) {
            String id = name.substring(PROP_PREFIX.length());
            if (id.indexOf('.') >= 0) {
                continue;   // no name or not a simple name of a calendar
            }
            if (id.equals(INSTANCE.getId())) {
                continue;           // do not duplicate the default
            }
            try {
                // Create and register the variant
                HijrahChronology chrono = new HijrahChronology(id);
                AbstractChronology.registerChrono(chrono);
            } catch (DateTimeException ex) {
                // Log error and continue
                PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
                logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
            }
        }
    }
}
 
Example 2
Source File: SourceClassName.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 3
Source File: SourceClassName.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform
        // logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 4
Source File: SourceClassName.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 5
Source File: HijrahChronology.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * For each Hijrah variant listed, create the HijrahChronology and register it.
 * Exceptions during initialization are logged but otherwise ignored.
 */
private static void registerVariants() {
    for (String name : calendarProperties.stringPropertyNames()) {
        if (name.startsWith(PROP_PREFIX)) {
            String id = name.substring(PROP_PREFIX.length());
            if (id.indexOf('.') >= 0) {
                continue;   // no name or not a simple name of a calendar
            }
            if (id.equals(INSTANCE.getId())) {
                continue;           // do not duplicate the default
            }
            try {
                // Create and register the variant
                HijrahChronology chrono = new HijrahChronology(id);
                AbstractChronology.registerChrono(chrono);
            } catch (DateTimeException ex) {
                // Log error and continue
                PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
                logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
            }
        }
    }
}
 
Example 6
Source File: HijrahChronology.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * For each Hijrah variant listed, create the HijrahChronology and register it.
 * Exceptions during initialization are logged but otherwise ignored.
 */
private static void registerVariants() {
    for (String name : calendarProperties.stringPropertyNames()) {
        if (name.startsWith(PROP_PREFIX)) {
            String id = name.substring(PROP_PREFIX.length());
            if (id.indexOf('.') >= 0) {
                continue;   // no name or not a simple name of a calendar
            }
            if (id.equals(INSTANCE.getId())) {
                continue;           // do not duplicate the default
            }
            try {
                // Create and register the variant
                HijrahChronology chrono = new HijrahChronology(id);
                AbstractChronology.registerChrono(chrono);
            } catch (DateTimeException ex) {
                // Log error and continue
                PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
                logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
            }
        }
    }
}
 
Example 7
Source File: HijrahChronology.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * For each Hijrah variant listed, create the HijrahChronology and register it.
 * Exceptions during initialization are logged but otherwise ignored.
 */
private static void registerVariants() {
    for (String name : calendarProperties.stringPropertyNames()) {
        if (name.startsWith(PROP_PREFIX)) {
            String id = name.substring(PROP_PREFIX.length());
            if (id.indexOf('.') >= 0) {
                continue;   // no name or not a simple name of a calendar
            }
            if (id.equals(INSTANCE.getId())) {
                continue;           // do not duplicate the default
            }
            try {
                // Create and register the variant
                HijrahChronology chrono = new HijrahChronology(id);
                AbstractChronology.registerChrono(chrono);
            } catch (DateTimeException ex) {
                // Log error and continue
                PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
                logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
            }
        }
    }
}
 
Example 8
Source File: HijrahChronology.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * For each Hijrah variant listed, create the HijrahChronology and register it.
 * Exceptions during initialization are logged but otherwise ignored.
 */
private static void registerVariants() {
    for (String name : calendarProperties.stringPropertyNames()) {
        if (name.startsWith(PROP_PREFIX)) {
            String id = name.substring(PROP_PREFIX.length());
            if (id.indexOf('.') >= 0) {
                continue;   // no name or not a simple name of a calendar
            }
            if (id.equals(INSTANCE.getId())) {
                continue;           // do not duplicate the default
            }
            try {
                // Create and register the variant
                HijrahChronology chrono = new HijrahChronology(id);
                AbstractChronology.registerChrono(chrono);
            } catch (DateTimeException ex) {
                // Log error and continue
                PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
                logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
            }
        }
    }
}
 
Example 9
Source File: SourceClassName.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 10
Source File: SourceClassName.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 11
Source File: HijrahChronology.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * For each Hijrah variant listed, create the HijrahChronology and register it.
 * Exceptions during initialization are logged but otherwise ignored.
 */
private static void registerVariants() {
    for (String name : calendarProperties.stringPropertyNames()) {
        if (name.startsWith(PROP_PREFIX)) {
            String id = name.substring(PROP_PREFIX.length());
            if (id.indexOf('.') >= 0) {
                continue;   // no name or not a simple name of a calendar
            }
            if (id.equals(INSTANCE.getId())) {
                continue;           // do not duplicate the default
            }
            try {
                // Create and register the variant
                HijrahChronology chrono = new HijrahChronology(id);
                AbstractChronology.registerChrono(chrono);
            } catch (DateTimeException ex) {
                // Log error and continue
                PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
                logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
            }
        }
    }
}
 
Example 12
Source File: SourceClassName.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 13
Source File: SourceClassName.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
Example 14
Source File: PlatformLoggerTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}
 
Example 15
Source File: PlatformLoggerTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}
 
Example 16
Source File: PlatformLoggerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}
 
Example 17
Source File: PlatformLoggerTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}
 
Example 18
Source File: PlatformLoggerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}
 
Example 19
Source File: PlatformLoggerTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}
 
Example 20
Source File: PlatformLoggerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLogMethods(PlatformLogger logger) {
    logger.severe("Test severe(String, Object...) {0} {1}", new Long(1), "string");
    // test Object[]
    logger.severe("Test severe(String, Object...) {0}", (Object[]) getPoints());
    logger.warning("Test warning(String, Throwable)", new Throwable("Testing"));
    logger.info("Test info(String)");
}