use of java.util.logging.ConsoleHandler in project ignite by apache.
the class JavaLogger method configure.
/**
* Configures handlers when needed.
*
* @param initImpl Optional log implementation.
*/
private void configure(@Nullable Logger initImpl) {
if (initImpl != null)
impl = initImpl;
if (inited)
return;
synchronized (mux) {
if (inited)
return;
if (isConfigured()) {
boolean consoleHndFound = findHandler(impl, ConsoleHandler.class) != null;
// User configured console appender, thus log is not quiet.
quiet0 = !consoleHndFound;
inited = true;
return;
}
defaultConfiguration();
boolean quiet = Boolean.valueOf(System.getProperty(IGNITE_QUIET, "true"));
boolean useConsoleAppender = Boolean.valueOf(System.getProperty(IGNITE_CONSOLE_APPENDER, "true"));
if (useConsoleAppender) {
ConsoleHandler consoleHnd = findHandler(impl, ConsoleHandler.class);
if (consoleHnd != null)
consoleHnd.setLevel(quiet ? SEVERE : INFO);
else
System.err.println("Console logging handler is not configured.");
} else {
Handler[] handlers = Logger.getLogger("").getHandlers();
if (!F.isEmpty(handlers)) {
for (Handler h : handlers) {
if (h instanceof ConsoleHandler)
impl.removeHandler(h);
}
}
}
quiet0 = quiet;
inited = true;
}
}
use of java.util.logging.ConsoleHandler in project karaf by apache.
the class BootstrapLogManager method getDefaultHandlersInternal.
private List<Handler> getDefaultHandlersInternal() {
String consoleLevel = System.getProperty("karaf.log.console", "OFF");
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.parse(consoleLevel));
return Arrays.asList(handler, getDefaultHandlerInternal());
}
use of java.util.logging.ConsoleHandler in project tomee by apache.
the class RoundRobinConnectionStrategyTest 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 BKCommonLib by bergerhealer.
the class ModuleLogger method createDefaultLogger.
private static Logger createDefaultLogger() {
if (!Common.IS_TEST_MODE)
return Bukkit.getLogger();
Logger log = Logger.getLogger("");
log.setUseParentHandlers(false);
CustomRecordFormatter formatter = new CustomRecordFormatter();
ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setFormatter(formatter);
for (Handler iHandler : log.getHandlers()) {
log.removeHandler(iHandler);
}
log.addHandler(consoleHandler);
return log;
}
use of java.util.logging.ConsoleHandler in project dukescript-presenters by dukescript.
the class KoBrowserTest method compatibilityTests.
@Factory
public static Object[] compatibilityTests() throws Exception {
Browser.LOG.setLevel(Level.FINE);
Browser.LOG.addHandler(new ConsoleHandler());
final BrowserBuilder bb = BrowserBuilder.newBrowser(new Browser("KoBrowserTest")).loadClass(KoBrowserTest.class).loadPage("empty.html").invoke("initialized");
Executors.newSingleThreadExecutor().submit(new Runnable() {
@Override
public void run() {
bb.showAndWait();
}
});
List<Object> res = new ArrayList<Object>();
Class<? extends Annotation> test = loadClass().getClassLoader().loadClass(KOTest.class.getName()).asSubclass(Annotation.class);
Class[] arr = (Class[]) loadClass().getDeclaredMethod("tests").invoke(null);
final HttpServer s = Browser.findServer(browserPresenter);
ServerConfiguration conf = s.getServerConfiguration();
conf.addHttpHandler(new DynamicHTTP(s), "/dynamic");
for (Class c : arr) {
for (Method m : c.getMethods()) {
if (m.getAnnotation(test) != null) {
res.add(new KOScript(browserPresenter, m));
}
}
}
return res.toArray();
}
Aggregations