tags:

views:

29

answers:

1

java.util.logging.Logger override the file data instead of add to end of file.

Is this correct? should I create 1 file for each time I initialize the app and the log system?

If not, how do I set it to write to the end of the file?

+1  A: 

java.util.logging.FileHandler.append=true

The append specifies whether the FileHandler should append onto any existing files (defaults to false).

FileHandler Doc

There are other properties you have control over like the size of log files and how many to cycle through but I think that property is the one you are concerned with.

Andrew Hubbs
ok, but now it is appending as it was a new file, creating a new xml header and a new root tag.. is there a way to solve this?
Tom Brito
@Tom Brito - what do you expect it to do? Read the existing file to see if it has an XML header and root element? And how do you propose to ensure that the XML log file gets a closing tag for its root element?
Stephen C
@Stephen if it does not have a closing tag the file is corrupted, it's not a valid xml.
Tom Brito
@Tom - I know. The point is, how is your log reading software going to cope with that ... if it cannot deal with an extra XML header, etc.
Stephen C
@Stephen right. By the way, I conclude that for my application is simplest to write my own simple logger.
Tom Brito