Log4J logs do not roll in size (Tomcat / Windows, if necessary) when the system is under load, why can it be?

Does anyone have any ideas

"why does our log4j log file not roll and continue to grow huge in size?"

.. It seems that this happens only in one of our environments. Besides,

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

We checked a few things, searched Google and Stack Oevrflow to no avail.

This is what we are studying now

"I read somewhere that some people see that rolling does not work if the application is running as a service, but it works fine if it is launched from the command line, we can check to make sure that this is not what we see (narrowing it again)? There were several people who saw this. "

Our configuration:

<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 idea what might happen here?

PS: We are thinking of changing the bufferedIO flag above (for performance), but it cannot be connected correctly?

+3
source share
2 answers

Do you seem to be working on Windows? If so, another process reading the log file may prevent it from rolling. You have applications that read a log file, for example, for monitoring. You see Log4J errors on the console exit from log4J at the tipping point.

+2
source

It turned out that this is a "load"! When the system was under too much registration, the file did not roll ... I think this is a problem with Windows + Log4J. Thanks for the suggestion, although this could be another reason!

0
source

Source: https://habr.com/ru/post/1795904/


All Articles