Ahadu Tsegaye Abebe
Ahadu Tsegaye Abebe

Reputation: 724

Log4J MaxFileSize limit exceeding issue

I'm using Log4j 1.2.16 in a java application. I've set log4j.properties file with the following values.

log4j.appender.R.MaxFileSize=20MB
log4j.appender.R.MaxBackupIndex=5 

The trouble is that, from time to time, the 20MB limit gets surpassed and I get huge files that can reach upto 200GB.

What I suspect is that the log writing process is getting max priority and writing a lot of data very fast and not letting the limit checking to be carried out until it's too late. Does that make any sense?

Could it be a Log4j bug? Or am I missing something?

Upvotes: 1

Views: 441

Answers (1)

venergiac
venergiac

Reputation: 7717

This should happen because in rollOver() method of RollingFileAppender.java, renaming of the current log file can fail.

For instance if you have opened the log file with another editor, LOG4J is not able to change the name.

Upvotes: 2

Related Questions