|
-
May 8th, 2008, 12:51 PM
#1
Deactivate Console Handler in java.util.logging
Hi,
I would like to deactivate the Console Handler for all logging events. I'm writing all log events with a File Handler directly to a file, but I don't know how to deactivate the Console Handler.
Any hints?
-
May 8th, 2008, 01:27 PM
#2
Re: Deactivate Console Handler in java.util.logging
Hints? RTFM
The JavaDoc for the Handler class says "A Handler can be disabled by doing a setLevel(Level.OFF) and can be re-enabled by doing a setLevel with an appropriate level.".
Experience is a poor teacher: it gives its tests before it teaches its lessons...
Anon.
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
May 8th, 2008, 01:35 PM
#3
Re: Deactivate Console Handler in java.util.logging
I think I've had this problem & used the following to fix it:
Code:
private static final Logger m_logger = Logger.getLogger("com.mycompany.myapp.trace");
...
m_logger.setUseParentHandlers(false);
If I remember correctly, the 'parent handlers' were doing the console logging that I wanted to turn off & thats how I handled it.
-
May 8th, 2008, 03:01 PM
#4
Re: Deactivate Console Handler in java.util.logging
Sorry, my fault. Just was to lazy to search the manual, rather asking the experts. 
Thanks dlorde & Martin O!
Both solutions work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|