logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "yin mingjun (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4J2-1486) when rolling target file exist, RollingFileManager would remove target log file and fail rollover log file
Date Thu, 28 Jul 2016 03:47:20 GMT
yin mingjun created LOG4J2-1486:
-----------------------------------

             Summary: when rolling target file exist, RollingFileManager would remove target
log file and fail rollover log file
                 Key: LOG4J2-1486
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1486
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.6.2
         Environment: mac osx capiton/jvm 1.7/log4j2 2.6.2
            Reporter: yin mingjun


I create two file, one is testcmd.log, other is testcmd.log.2016-07-24
then, I touch the testcmd.log's modified time:
{{touch -t 1607240101 testcmd.log}}

and I write some code like this:
{code}
    @Test
    public void testRollingFileManager() {
        TriggeringPolicy triggerPolicy = TimeBasedTriggeringPolicy.createPolicy("1", "true");
        DefaultRolloverStrategy rolloverStrategy = DefaultRolloverStrategy.createStrategy("7",
"1", "max", null, null, false, new NullConfiguration());
        RollingFileManager fileManager = RollingFileManager.getFileManager("testcmd.log",
"testcmd.log.%d{yyyy-MM-dd}", true, true, triggerPolicy, rolloverStrategy, null, PatternLayout.createDefaultLayout(),
0, true);

        //trigger rollover
        fileManager.rollover();
    }
 {code}

I run this code, find that testcmd.log.2016-07-24 is disappear !!!

I think the file pattern dos't contain "%i", the purge process can be ignored (the file is
removed during purge operation). And the other advise is, IF the destination file is already
exists, we should just ignore the rolling over operation. Anyway, the lost of a log file has
more harms for us.

thanks.

yin mingjun




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message