use of java.util.logging.Handler in project randomizedtesting by randomizedtesting.
the class WithNestedTestClass method clearNested.
@AfterClass
public static final void clearNested() throws Exception {
zombieToken = null;
runningNested = false;
ApplyAtPlace.runnable = null;
ApplyAtPlace.place = null;
System.setOut(sysout);
System.setErr(syserr);
for (Handler h : logger.getHandlers()) logger.removeHandler(h);
for (Handler h : handlers) logger.addHandler(h);
for (Thread t : zombies) {
t.interrupt();
}
for (Thread t : zombies) {
t.join();
}
}
use of java.util.logging.Handler in project spring-boot by spring-projects.
the class LogbackLoggingSystemTests method bridgeHandlerInstalled.
private boolean bridgeHandlerInstalled() {
java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("");
Handler[] handlers = rootLogger.getHandlers();
for (Handler handler : handlers) {
if (handler instanceof SLF4JBridgeHandler) {
return true;
}
}
return false;
}
use of java.util.logging.Handler in project gfm_viewer by satyagraha.
the class SimpleLogging method setupLogging.
public static void setupLogging() {
if (isDebugging()) {
Logger rootLogger = Logger.getLogger("");
for (Handler handler : rootLogger.getHandlers()) {
handler.setLevel(Level.FINE);
}
// Set root logger level
rootLogger.setLevel(Level.FINE);
}
}
use of java.util.logging.Handler in project syncany by syncany.
the class CommandLineClient method initLogHandlers.
private void initLogHandlers(OptionSet options, OptionSpec<String> optionLog, OptionSpec<Void> optionLogPrint, OptionSpec<Void> optionDebug) throws SecurityException, IOException {
// --log=<file>
String logFilePattern = null;
if (options.has(optionLog)) {
if (!"-".equals(options.valueOf(optionLog))) {
logFilePattern = options.valueOf(optionLog);
}
} else if (config != null && config.getLogDir().exists()) {
logFilePattern = config.getLogDir() + File.separator + LOG_FILE_PATTERN;
} else {
logFilePattern = UserConfig.getUserLogDir() + File.separator + LOG_FILE_PATTERN;
}
if (logFilePattern != null) {
Handler fileLogHandler = new FileHandler(logFilePattern, LOG_FILE_LIMIT, LOG_FILE_COUNT, true);
fileLogHandler.setFormatter(new LogFormatter());
Logging.addGlobalHandler(fileLogHandler);
}
// --debug, add console handler
if (options.has(optionDebug) || options.has(optionLogPrint) || (options.has(optionLog) && "-".equals(options.valueOf(optionLog)))) {
Handler consoleLogHandler = new ConsoleHandler();
consoleLogHandler.setFormatter(new LogFormatter());
Logging.addGlobalHandler(consoleLogHandler);
}
}
use of java.util.logging.Handler in project commons by twitter.
the class RootLogConfig method setConsoleHandler.
private static void setConsoleHandler(Logger logger, boolean removeOtherHandlers) {
Handler consoleHandler = null;
for (Handler h : logger.getHandlers()) {
if (h instanceof ConsoleHandler) {
consoleHandler = h;
} else if (removeOtherHandlers) {
logger.removeHandler(h);
}
}
if (consoleHandler == null) {
consoleHandler = new ConsoleHandler();
logger.addHandler(new ConsoleHandler());
}
consoleHandler.setLevel(Level.ALL);
consoleHandler.setFilter(null);
}
Aggregations