Hamza Yerlikaya
Hamza Yerlikaya

Reputation: 49329

Java FileHandler disable log rotation

I am trying to disable log rotation, for file handler using,

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

What i want is one log, created for each run i do not want rotation or backing up of the old file, but using this initialization i get run.log run.log.1 run.log.2 for each run.

Also

        logger.setUseParentHandlers(false);

is set to false.

Upvotes: 0

Views: 2051

Answers (3)

S.Yavari
S.Yavari

Reputation: 876

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

Upvotes: 0

sparkyspider
sparkyspider

Reputation: 13519

Handler fileHandler = new FileHandler(FILE_PATH, true);

Upvotes: 0

Bombe
Bombe

Reputation: 83849

Try 0 as the limit instead of 1000000.

Upvotes: 1

Related Questions