Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable java log rotation

I use java.util.logging.Logger to log in my app :

    FileHandler fh=new FileHandler(this.todayFileName, 0, 1, true);

    fh.setFormatter(new SimpleFormatter());

    Logger.getLogger(rootLogger.getName()).setLevel(Level.ALL);

    Logger.getLogger(rootLogger.getName()).addHandler(fh); 

but this does work well except that log rotation is enabled.

and i get files :

run.log run.log.1 run.log.2

what I want is to get only one log file, with no rotation enabled.

how do I do that ?

like image 208
Attilah Avatar asked Jun 28 '26 12:06

Attilah


1 Answers

If you run the same application more than once at the same time, java.util.logging will create many log file like run.log run.log.1 run.log.2

And are you sure that your application close correctly, because I already got this problem. Since my application didn't close correctly, when I started my application, that created a myApplication.log.1

like image 95
Nettogrof Avatar answered Jul 01 '26 03:07

Nettogrof



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!