Example usage for java.util.logging LogManager reset

List of usage examples for java.util.logging LogManager reset

Introduction

In this page you can find the example usage for java.util.logging LogManager reset.

Prototype


public void reset() throws SecurityException 

Source Link

Document

Reset the logging configuration.

Usage

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

/**
 *
 * @param id/*from   w  w w  . java2  s  .  co  m*/
 * @throws IOException
 */
protected void setupLogManager(String id) throws IOException {
    String cfgPath = System.getProperty("resources.path");
    File cfgFile = new File(cfgPath, id + ".properties");

    assertNotNull(cfgPath);
    assertTrue(cfgFile.exists());

    LogManager manager = LogManager.getLogManager();
    manager.reset();
    manager.readConfiguration(new FileInputStream(cfgFile));
}

From source file:org.echocat.jomon.runtime.logging.Slf4jUtils.java

@Nonnull
public static Installation tryInstallJulToSlf4jBridge(@Nullable ILoggerFactory loggerFactory,
        @Nullable LogManager logManager) {
    final Jul2Slf4jHandler newHandler = new Jul2Slf4jHandler(loggerFactory);
    final LogManager manager = logManager != null ? logManager : getLogManager();
    manager.reset();
    final java.util.logging.Logger logger = manager.getLogger("");
    final List<Handler> originalHandlers = new ArrayList<>();
    for (final Handler oldHandlers : logger.getHandlers()) {
        logger.removeHandler(oldHandlers);
        originalHandlers.add(newHandler);
    }//  ww  w.  ja  v a2s.co m
    logger.addHandler(newHandler);
    return new Jul2Slf4jInstallation(originalHandlers, newHandler, manager);
}