Example usage for java.util.logging Logger GLOBAL_LOGGER_NAME

List of usage examples for java.util.logging Logger GLOBAL_LOGGER_NAME

Introduction

In this page you can find the example usage for java.util.logging Logger GLOBAL_LOGGER_NAME.

Prototype

String GLOBAL_LOGGER_NAME

To view the source code for java.util.logging Logger GLOBAL_LOGGER_NAME.

Click Source Link

Document

GLOBAL_LOGGER_NAME is a name for the global logger.

Usage

From source file:processing.app.Base.java

static public void initLogger() {
    Handler consoleHandler = new ConsoleLogger();
    consoleHandler.setLevel(Level.ALL);
    consoleHandler.setFormatter(new LogFormatter("%1$tl:%1$tM:%1$tS [%4$7s] %2$s: %5$s%n"));

    Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
    globalLogger.setLevel(consoleHandler.getLevel());

    // Remove default
    Handler[] handlers = globalLogger.getHandlers();
    for (Handler handler : handlers) {
        globalLogger.removeHandler(handler);
    }// w  ww .j  a v  a2  s.c  o  m
    Logger root = Logger.getLogger("");
    handlers = root.getHandlers();
    for (Handler handler : handlers) {
        root.removeHandler(handler);
    }

    globalLogger.addHandler(consoleHandler);

    Logger.getLogger("cc.arduino.packages.autocomplete").setParent(globalLogger);
    Logger.getLogger("br.com.criativasoft.cpluslibparser").setParent(globalLogger);
    Logger.getLogger(Base.class.getPackage().getName()).setParent(globalLogger);

}