Discussion:
Set Log Level in Output Window
Antoniossss
2011-12-26 19:45:30 UTC
Permalink
Hello guys.

I am aware that this topic is certinly dead by now, but i think that there can be more people like you and me that looking for answer on " how to set level for default console logger in NB"

I guess that u figured it out by now. If not than check this solution:
Simply change logging level for default GLOBAL logger


Code:
LogManager.getLogManager().getLogger("global").setLevel(Level.SEVERE);



simply paste this simple line of code into begining of your static main method.
Voila
Console in nb is clear of your infos and lower logs
The advantage of this solution is that u dont have to write massive block of code, and u are not modifying global settings in JRD_DIR\lib\loggint.properies file, co the changes are only for your particular project

Im not native, so sory for my bad english :)
take care!
ebaumann
2011-12-27 22:46:05 UTC
Permalink
LogManager.getLogManager().getLogger("").setLevel(Level.SEVERE);
The origin poster will see FINEST level messages. And even the publishing logger's handler's (http://docs.oracle.com/javase/7/docs/api/java/util/logging/Handler.html) level has to log FINEST messages. So it's better to call


Code:
Handler systemOutHandler = new StreamHandler(System.out, new SimpleFormatter());
systemOutHandler.setLevel(Level.FINEST);
Logger rootLogger = Logger.getLogger("");
rootLogger.addHandler(systemOutHandler);
rootLogger.setLevel(Level.FINEST);



The code above only works for loggers not calling Logger.setUseParentHandlers(false).

As mentioned obove in this thread: What a logger does not log, can't appear in the output window. That means, the created loggers and their handlers must have the level FINEST or a lower lever value than FINEST (and to be precice, no filters preventing publishing). If the level is not set explicitly, INFO is the default and so FINEST messages will not be published because the level value of FINEST is lower than the INFO level value.
Loading...