Logging exception with java.util.logging.Logger#log() to file only

Discussion in 'Java' started by Royan, Apr 1, 2008.

  1. Royan

    Royan Guest

    I'm logging exceptions with java.util.logging.Logger#log() (i can't
    use anything apart from standard Java API) and i don't want any stack
    trace to appear in stdout or stderr is there any way I can filter or
    redirect all output that is produced buy this method into the file
    only?
    Royan, Apr 1, 2008
    #1
    1. Advertising

  2. Re: Logging exception with java.util.logging.Logger#log() to fileonly

    Royan wrote:
    > I'm logging exceptions with java.util.logging.Logger#log() (i can't
    > use anything apart from standard Java API) and i don't want any stack
    > trace to appear in stdout or stderr is there any way I can filter or
    > redirect all output that is produced buy this method into the file
    > only?


    You can use Level.FINE to log exception and Level.INFO for others message.

    Then you can configure the ConsoleHandler to output only the the message
    above the INFO level and the FileHandler to output ALL messages.
    These configurations are done in the logging.properties configuration file.
    There is a global logging.properties file located in your {JRE}/lib
    directory, but you can use your own with:

    java -Djava.util.logging.config.file=mylogging.properties

    --
    Andrea Francia
    http://www.andreafrancia.it/
    Andrea Francia, Apr 1, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Siegl
    Replies:
    0
    Views:
    955
    Stefan Siegl
    Aug 27, 2003
  2. CD1
    Replies:
    3
    Views:
    18,514
  3. Gugle
    Replies:
    3
    Views:
    1,237
    Gugle
    Dec 12, 2006
  4. Frank
    Replies:
    1
    Views:
    906
    Daniel Pitts
    Dec 7, 2006
  5. cteb
    Replies:
    5
    Views:
    7,296
    Arne Vajhøj
    Oct 5, 2008
Loading...

Share This Page