use of java.util.logging.ConsoleHandler in project tomee by apache.
the class ReconnectDelayListSelfTest method set.
private static void set(final Logger logger, final Level level) {
final ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(level);
logger.addHandler(consoleHandler);
logger.setLevel(level);
logger.setUseParentHandlers(false);
}
use of java.util.logging.ConsoleHandler in project gatk by broadinstitute.
the class LoggingUtils method setJavaUtilLoggingLevel.
/**
* Set the java.util.logging level since some of our dependencies write messages using it.
*
* Taken with modifications from a post by michel.iamit
* http://stackoverflow.com/users/369060/michel-iamit
* from http://stackoverflow.com/questions/470430/java-util-logging-logger-doesnt-respect-java-util-logging-level
*/
private static void setJavaUtilLoggingLevel(final Log.LogLevel verbosity) {
Logger topLogger = java.util.logging.Logger.getLogger("");
Handler consoleHandler = null;
for (Handler handler : topLogger.getHandlers()) {
if (handler instanceof ConsoleHandler) {
consoleHandler = handler;
break;
}
}
if (consoleHandler == null) {
consoleHandler = new ConsoleHandler();
topLogger.addHandler(consoleHandler);
}
consoleHandler.setLevel(levelToJavaUtilLevel(verbosity));
}
use of java.util.logging.ConsoleHandler in project ceylon-compiler by ceylon.
the class Launcher method initLogger.
private static void initLogger(Logger logger, boolean verbose) {
boolean handlersExists = false;
for (Handler handler : logger.getHandlers()) {
handlersExists = true;
// formatter has to be in the boot class path. This way it doesn't.
if (handler instanceof ConsoleHandler) {
handler.setFormatter(CeylonLogFormatter.INSTANCE);
if (verbose) {
handler.setLevel(Level.ALL);
}
}
}
if (verbose) {
//TODO do not configure root logger, make it flags aware
logger.setLevel(Level.ALL);
if (handlersExists == false) {
ConsoleHandler handler = new ConsoleHandler();
handler.setFormatter(CeylonLogFormatter.INSTANCE);
handler.setLevel(Level.ALL);
logger.addHandler(handler);
}
}
}
use of java.util.logging.ConsoleHandler in project dukescript-presenters by dukescript.
the class Test method main.
public static void main(final String... args) throws Exception {
Logger l = Logger.getLogger("com.dukescript");
l.setLevel(Level.FINE);
ConsoleHandler ch = new ConsoleHandler();
ch.setLevel(Level.FINE);
l.addHandler(ch);
l.setUseParentHandlers(false);
Thread t = new Thread("Testing harness") {
@Override
public void run() {
try {
processTests();
} catch (Exception ex) {
LOG.log(Level.SEVERE, null, ex);
}
}
};
t.start();
BrowserBuilder.newBrowser().loadPage("pages/test.html").loadClass(Test.class).invoke("onLoad", args).showAndWait();
}
Aggregations