[java.util.logging] logging only to _one_ file

Discussion in 'Java' started by Stefan Siegl, Aug 27, 2003.

  1. Stefan Siegl

    Stefan Siegl Guest

    Hello

    I am using the java.util.logging API and really like it. I used an XML
    Handler for each logger storing the information as XML in XML files.
    (that´s the default for the FileHandler class). All is going quite fine,
    but I will get a lot of different files:

    I created the log file as "output.xml" but in the directory are a lot of
    other files:
    output.xml.1
    output.xml
    output.xml.lck
    output.xml.1.lck

    You might say that this is not so dramatic, but I have four loggers and
    when my program runs for about two days I will habe about 500 files in
    this folder (the number at the end of the files is incremented in these
    files).

    Here is the code snippet how I create my logger:

    [...]

    Logger log = Logger.getLogger("Output");
    log.setUseParentHandlers(false);
    log.setLevel(Level.ALL);

    FileHandler xmlLogFile = new
    FileHandler([somepath]+"/output.xml",0,1,true);
    xmlLogFile.setLevel(Level.FINEST);

    log.addHandler(xmlLogFile);

    [...]

    Thank you
    Stefan
    Stefan Siegl, Aug 27, 2003
    #1
    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. Michael T. Peterson
    Replies:
    2
    Views:
    721
    Michael T. Peterson
    Sep 9, 2003
  2. janne
    Replies:
    0
    Views:
    9,431
    janne
    Sep 10, 2004
  3. Java script Dude

    java.util.logging for Java 1.3.1

    Java script Dude, Oct 27, 2005, in forum: Java
    Replies:
    2
    Views:
    656
    Tor Iver Wilhelmsen
    Oct 28, 2005
  4. Royan
    Replies:
    1
    Views:
    1,402
    Andrea Francia
    Apr 1, 2008
  5. johnmmcparland
    Replies:
    1
    Views:
    4,058
    johnmmcparland
    Jan 9, 2009
Loading...

Share This Page