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

S

Stefan Siegl

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top