tags:

views:

561

answers:

3

Hello there SO'ers,

I got a quite simple problem but cant find a solution for it. I have a logger with a file handler added, but it still spams to hell out of my console. How could I get the logger to solely route all output to a file, with NO console outputs?

Thanks a lot,

cru

+2  A: 

Remove all handlers (using Logger.getHandlers() and calling Logger.removeHandler() for each handler) from the root logger before adding your file handler.

Bombe
+4  A: 

The simplest way to guarantee that nothing will be written to the console is to put:

java.util.logging.ConsoleHandler.level = NONE

in your logging configuration file.

Lachlan
A: 

Old question but to help other developers:

You can also just use logger.setUseParentHandlers(false) on your logger.

Jaran