Daniel Iversen
Daniel Iversen

Reputation: 495

Log4J logs not rolling on size (Tomcat/Windows if relevant) when the system is under load, why could that be?

Does anyone have some ideas of;

" why our log4j log file does not roll and keep growing huge in size?"

..It seems to only happen in one of our environments as well. Also,

The log file only does not roll when the machine is under load!

We've tested a few thing, searched Google and Stack Oevrflow to no avail.

Here's the things we are currently looking into;

"I read somewhere that some people see rolling not working if the app is started as a service but it works fine if its started from command line, could we test to make sure thats not what we are seeing (narrowing it down again)? There were a few people who saw this."

Our config is;

<appender name="file" class="org.apache.log4j.RollingFileAppender">
    <param name="file" value="D:/myloglocation/subfolder/mylog.txt"/>
    <param name="MaxFileSize" value="5MB"/>
    <param name="MaxBackupIndex" value="50"/>
    <param name="append" value="false"/>
    <param name="bufferedIO" value="false"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t] [%c{4}] %m%n"/>
    </layout>
</appender>

Does anyone have any ideas at all of what could be happening here?

PS: We are thinking of changing the bufferedIO flag above (for performance), but that couldn't be related right?

Upvotes: 3

Views: 3225

Answers (2)

Daniel Iversen
Daniel Iversen

Reputation: 495

It turned out to be "load" related! When the system was under too much logging load, the file would not roll... think its a Windows+Log4J specific problem.. Thanks for the suggestion though, that could have been another reason!

Upvotes: 0

Will
Will

Reputation: 241

It appears you are running on windows? If so, another process reading the log file can prevent rolling. Do have any apps reading the log file, for say, monitoring purposes. Do you see any errors from Log4J in the console output from log4J at the rollover point.

Upvotes: 2

Related Questions