David Clutter created LOG4J2-1014:
-------------------------------------

             Summary: RollingFileAppender OnStartupTriggerPolicy fails when 
append="false"
                 Key: LOG4J2-1014
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1014
             Project: Log4j 2
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.2
         Environment: Windows
            Reporter: David Clutter


I want to Roll the File on startup and when the file is 1MB.  The current file 
should be cleared when the roll happens so append="false".  When append is 
false the startup trigger clears the main file without rolling it.

If i set append to "true".  the startup trigger rolls the file properly but 
then it keeps appending so my first rolled log is 1MB, the second is 2MB, the 
third is 3MB. and so that the main file just keeps growing and the rolled files 
are each an increment bigger than the previous.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Properties>
        <Property name="patternLayout">%d{yyyy-MM-dd HH:mm:ss.SSS} [%10.10t] 
%X{client} %-5p %c{2} - %m%n</Property>
    </Properties>
    <Appenders>
        <RollingFile name="ProbeFile" fileName="probe.log" 
filePattern="probe-%i.log" append="false">
            <PatternLayout pattern="${patternLayout}"/>
            <Policies>
                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="1 MB"/>
            </Policies>
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
    </Appenders>

    <!-- Logger Levels: all, trace, debug, info, warn, error, fatal, off -->
    <Loggers>
        <Root level="info">
            <AppenderRef ref="ProbeFile"/>
        </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