houssem mzoughi created LOG4J2-1027:
---------------------------------------

             Summary: TimeBasedTriggeringPolicy is not working as expected
                 Key: LOG4J2-1027
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1027
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
            Reporter: houssem mzoughi


The configuration is not resolved when file rolls over at the end/start of the 
day.

Expected: when the file rolls over, I would expect that the variables in 
fileName configuration would be resolved again to its current values and a new 
file created in a folder for the current day. I.e. the logs are always written 
to the directory for the current date.

Actual: logging continues using the file that was created at startup. I.e. in 
the folder for the day the application was started.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">

    <Appenders>

        <RollingRandomAccessFile name="File"
                                 
fileName="c:/temp/${date:yyyyMMdd}/App-${date:yyyyMMdd_HHmmss}.log"
                                 
filePattern="c:/temp/$${date:yyyyMMdd}/App-%d{yyyyMMdd}-%i.log.zip"
                                 immediateFlush="false"
                                 append="true">

            <PatternLayout>
                <Pattern>%-5p %d{HH:mm:ss,SSS} [%t] [%c{1}] (%F:%L) - %m 
%n</Pattern>
            </PatternLayout>

            <Policies>
                <OnStartupTriggeringPolicy />
                <TimeBasedTriggeringPolicy />
            </Policies>

        </RollingRandomAccessFile>

    </Appenders>

    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="File" />
        </Root>
    </Loggers>

</Configuration>




--
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