Ben Hess created LOG4J2-1073:
--------------------------------

             Summary: RollingFileAppender working file and archives have wrong 
date values
                 Key: LOG4J2-1073
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1073
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.3
            Reporter: Ben Hess


Suppose I have RollingFile appenders within a Route.  Configuration below 
explanation - pretty typical, should rollover every day.

Suppose today's date is Jul 2 2015, and the program has been running since Jun 
30 2015.

So for each Routed RollingFile I should have three files with entries having 
the correct dates:
program-general.log                      - has entries from 7/2/2015 only
program-general.2015-07-01.log  - has entries from 7/1/2015 only
program-general.2015-06-30.log  - has entries from 6/30/2015 only

Except what I have is the following:
program-general.log                      - has entries from 6/30 - 7/02
program-general.2015-07-01.log  - has entries from 6/30 - 7/01
program-general.2015-06-30.log  - has entries from 6/30

The relevant configuration:
<Appenders>
        <RollingFile name="generalAppender" fileName="logs/program-general.log" 
filePattern="logs/program-general.%d{yyyy-MM-dd}.log">          
                <PatternLayout pattern="%d [%t] %-5p %c{1} - %m%n %ex"/>        
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                <DefaultRolloverStrategy max="7"/>      
        </RollingFile>

    <Routing name="RoutingAppender">
        <Routes pattern="${ctx:propertyId}">
            <Route>
                <RollingFile name="Rolling-${ctx:propertyId}"
                             fileName="logs/program-${ctx:propertyId}.log"
                             
filePattern="logs/program-${ctx:propertyId}.%d{yyyy-MM-dd}.log">
                   
                    <PatternLayout pattern="%d [%t] %-5p %c{1} - %m%ex%n"/>
                                        <TimeBasedTriggeringPolicy interval="1" 
modulate="true"/>
                        <DefaultRolloverStrategy max="7"/>
                </RollingFile>
            </Route>
            <Route ref="generalAppender" key="${ctx:propertyId}"/>
         </Routes>
    </Routing>
</Appenders>





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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to