Example usage for java.util.logging Logger getUseParentHandlers

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

Introduction

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

Prototype

public boolean getUseParentHandlers() 

Source Link

Document

Discover whether or not this logger is sending its output to its parent logger.

Usage

From source file:com.twitter.common.net.http.handlers.LogConfig.java

private void maybeAdjustHandlerLevels(Logger logger, Level newLevel) {
    do {//from  w ww. jav a2 s  .  c  om
        for (Handler handler : logger.getHandlers()) {
            Level handlerLevel = handler.getLevel();
            if (newLevel.intValue() < handlerLevel.intValue()) {
                handler.setLevel(newLevel);
            }
        }
    } while (logger.getUseParentHandlers() && (logger = logger.getParent()) != null);
}

From source file:net.openhft.chronicle.logger.jul.JulTestBase.java

protected void testChronicleConfiguration(String testId, Class<? extends Handler> expectedHandlerType)
        throws IOException {

    setupLogManager(testId);//from w  w  w.ja  v a2 s.c  om
    Logger logger = Logger.getLogger(testId);

    assertEquals(Level.INFO, logger.getLevel());
    assertFalse(logger.getUseParentHandlers());
    assertNull(logger.getFilter());
    assertNotNull(logger.getHandlers());
    assertEquals(1, logger.getHandlers().length);

    assertTrue(logger.getHandlers()[0].getClass() == expectedHandlerType);
}

From source file:com.googlecode.fightinglayoutbugs.FightingLayoutBugs.java

private void enableDebugOutputToConsole(Logger logger) {
    do {//from   ww w . j  a v a 2  s  . c  om
        for (final Handler handler : logger.getHandlers()) {
            if (handler instanceof ConsoleHandler) {
                final Level originalConsoleLogLevel = handler.getLevel();
                handler.setLevel(Level.FINE);
                _runAfterAnalysis.add(new Runnable() {
                    @Override
                    public void run() {
                        handler.setLevel(originalConsoleLogLevel);
                    }
                });
            }
        }
    } while (logger.getUseParentHandlers() && (logger = logger.getParent()) != null);
}