CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    31

    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?

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    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.

  3. #3
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    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.

  4. #4
    Join Date
    Jun 2005
    Posts
    31

    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
  •  





Click Here to Expand Forum to Full Width

Featured