You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2021/03/02 23:59:00 UTC

[jira] [Assigned] (LOG4J2-1014) RollingFileAppender OnStartupTriggerPolicy fails when append="false"

     [ https://issues.apache.org/jira/browse/LOG4J2-1014?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers reassigned LOG4J2-1014:
-----------------------------------

    Assignee: Ralph Goers

> 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
>            Assignee: Ralph Goers
>            Priority: Major
>
> 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.
> {code}
> <?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>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)