// Set all console handlers to shup up except for important messages
final Handler[] handlers = Logger.getLogger("").getHandlers();
for (final Handler handler : handlers) {
if (handler instanceof ConsoleHandler) {
final ConsoleHandler c = (ConsoleHandler) handler;
c.setLevel(Level.FINE);
}
}
} else {
// Set configuration for logger.
Logger.getLogger("").setLevel(level);
Logger.getLogger("java").setLevel(Level.WARNING);
// Set all console handlers to shup up except for important messages
final Handler[] handlers = Logger.getLogger("").getHandlers();
for (final Handler handler : handlers) {
if (handler instanceof ConsoleHandler) {
final ConsoleHandler c = (ConsoleHandler) handler;
c.setLevel(level);
}
}
}
}