Example usage for java.util.logging Level intValue

List of usage examples for java.util.logging Level intValue

Introduction

In this page you can find the example usage for java.util.logging Level intValue.

Prototype

public final int intValue() 

Source Link

Document

Get the integer value for this level.

Usage

From source file:org.mili.core.logging.java.JavaAdapter.java

boolean isWarn() {
    Level level = logger.getLevel();
    return isOn() && (isAll() || Level.WARNING.intValue() >= level.intValue());
}

From source file:org.mili.core.logging.java.JavaAdapter.java

boolean isInfo() {
    Level level = logger.getLevel();
    return isOn() && (isAll() || Level.INFO.intValue() >= level.intValue()
            || Level.CONFIG.intValue() >= level.intValue());
}

From source file:org.mili.core.logging.java.JavaAdapter.java

boolean isDebug() {
    Level level = logger.getLevel();
    return isOn() && (isAll() || Level.FINER.intValue() >= level.intValue()
            || Level.FINE.intValue() >= level.intValue());
}

From source file:org.mili.core.logging.java.JavaAdapter.java

boolean isTrace() {
    Level level = logger.getLevel();
    return isOn() && (isAll() || Level.FINEST.intValue() >= level.intValue());
}

From source file:org.openqa.selenium.server.log.LoggingManager.java

public static void overrideSimpleFormatterWithTerseOneForConsoleHandler(Logger logger, boolean debugMode) {
    for (Handler handler : logger.getHandlers()) {
        if (handler instanceof ConsoleHandler) {
            final Formatter formatter;

            formatter = handler.getFormatter();
            if (formatter instanceof SimpleFormatter) {
                final StdOutHandler stdOutHandler;
                final Level originalLevel;

                /*/*from   www  . j a va2 s . co m*/
                 * DGF - Nobody likes the SimpleFormatter; surely they wanted our terse formatter instead.
                 */
                originalLevel = handler.getLevel();
                handler.setFormatter(new TerseFormatter(false));
                handler.setLevel(Level.WARNING);

                /*
                 * Furthermore, we all want DEBUG/INFO on stdout and WARN/ERROR on stderr
                 */
                stdOutHandler = new StdOutHandler();
                stdOutHandler.setFormatter(new TerseFormatter(false));
                stdOutHandler.setFilter(new MaxLevelFilter(Level.INFO));
                stdOutHandler.setLevel(originalLevel);
                logger.addHandler(stdOutHandler);
                if (debugMode) {
                    if (originalLevel.intValue() > Level.FINE.intValue()) {
                        stdOutHandler.setLevel(Level.FINE);
                    }
                }
            }
        }
    }
}

From source file:shuffle.fwk.ShuffleController.java

/**
 * The main which starts the program./* ww w  . jav a 2 s .co  m*/
 * 
 * @param args
 *           unused.
 */
public static void main(String... args) {
    String userHomeArg = null;
    String levelToSetArg = null;

    if (args != null && args.length > 0) {
        userHomeArg = args[0];
        if (args.length > 1) {
            levelToSetArg = args[1];
        }
    }

    if (userHomeArg == null) {
        userHomeArg = System.getProperty("user.home") + File.separator + "Shuffle-Move";
    }
    setUserHome(userHomeArg);
    try {
        FileHandler handler = new FileHandler();
        Logger toRoot = LOG;
        while (toRoot.getParent() != null) {
            toRoot = toRoot.getParent();
        }
        toRoot.addHandler(handler);
    } catch (SecurityException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    if (levelToSetArg != null) {
        try {
            Level levelToSet = Level.parse(args[1]);
            Logger.getLogger(SimulationTask.class.getName()).setLevel(levelToSet);
            SimulationTask.setLogFiner(levelToSet.intValue() <= Level.FINER.intValue());
            Logger.getLogger(ShuffleModel.class.getName()).setLevel(levelToSet);
        } catch (Exception e) {
            LOG.fine("Cannot set simulation logging to that level: " + StringUtils.join(args));
        }
    }

    ShuffleController ctrl = new ShuffleController();
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            ctrl.getFrame().launch();
        }
    });
}

From source file:tiemens.util.instancer.antlr.InstancerCode.java

/**
 * If loggingConfigureString is NOT UPPER CASE,
 * Then/*from ww  w  .  j a v  a 2 s .  c o  m*/
 *    If uselogger's handler(s) are examined and changed if they
 *       would not log at 'newLevel'
 * 
 * @param newLevel the parsed loggingConfigureString
 * @param uselogger whose handler(s) we change
 * @param loggingConfigureString original configuration string
 */
private void updateHandlers(Level newLevel, Logger uselogger, String loggingConfigureString) {
    List<Handler> handlers = new ArrayList<Handler>();
    Logger walk = uselogger;
    while (walk != null) {
        for (Handler add : walk.getHandlers()) {
            handlers.add(add);
        }
        walk = walk.getParent();
    }

    for (Handler handler : handlers) {
        metaLoggerInfo(
                "Handler level = " + handler.getLevel().intValue() + "newLevel = " + newLevel.intValue());

        if (handler.getLevel().intValue() > newLevel.intValue()) {
            if (!loggingConfigureString.equals(loggingConfigureString.toUpperCase())) {
                String note = "Note: setting handler level to '" + loggingConfigureString + "'.";
                String explain = "Use '" + loggingConfigureString.toUpperCase() + "' to prevent this behavior.";
                String msg = "Instancer: " + note + "  " + explain;
                metaLoggerInfo(msg);
                logger.info(msg);
                handler.setLevel(newLevel);
            }
        }
    }
}