Java FileHandler disable log rotation

I am trying to disable log rotation, to use a file handler,

FileHandler fh = new FileHandler
    ( "path" + "run.log", 1000000, 1, false);

      

What I want is one log generated for each run. I don't want to rotate or back up the old file, but using this initialization, I run run.log run.log.1 run.log.2 for every run.

Besides

        logger.setUseParentHandlers(false);

      

set to false.

0


a source to share


3 answers


Try 0

as limit instead 1000000

.



+1


a source


Try the following: FileHandler fh = new FileHandler( "path" + "run.log", 1000000, 1, true);



0


a source


Handler fileHandler = new FileHandler(FILE_PATH, true);

      

0


a source







All Articles