You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Parkirat Singh Bagga (JIRA)" <ji...@apache.org> on 2014/08/03 15:06:11 UTC

[jira] [Created] (LOG4J2-758) Log file getting overwritten when using both OnStartupTriggeringPolicy and TimeBasedTriggeringPolicy.

Parkirat Singh Bagga created LOG4J2-758:
-------------------------------------------

             Summary: Log file getting overwritten when using both OnStartupTriggeringPolicy and TimeBasedTriggeringPolicy.
                 Key: LOG4J2-758
                 URL: https://issues.apache.org/jira/browse/LOG4J2-758
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders, Configurators, Core
    Affects Versions: 2.0
         Environment: MAC, Eclipse, Java
            Reporter: Parkirat Singh Bagga
         Attachments: log4j2.xml

I am using Rolling File Appender with the Log4j2 2.0 version jar.

Now when I use both OnStartupTriggeringPolicy and TimeBasedTriggeringPolicy set with the interval 3 minutes and use the OnStartupTriggeringPolicy policy to roll at the server restart.

Now if, my file pattern has only date pattern set (%d{yyyy-MM-dd-HH-mm}) and not %i, and I restart the server more than 3-4 times, the policy rolls the
file to future time and when the TimeBasedTriggeringPolicy tries to roll the
file, those files are already present due to rollover by restarting the server many times and that earlier log file gets overwritten.

This leads to loss of the logging thus I think OnStartupTriggeringPolicy
policy when does a rollover, should add the currentTimeMillis to the log
file name as well.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org