You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Xiaoshuang LU (JIRA)" <ji...@apache.org> on 2017/07/03 02:28:00 UTC

[jira] [Updated] (LOG4J2-1964) dynamic configuration does not work for filePattern of RollingFile

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

Xiaoshuang LU updated LOG4J2-1964:
----------------------------------
    Description: 
The initial log4j2.xml file was
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" monitorInterval="60">
    <Properties>
        <Property name="LOG_HOME">./logs</Property>
    </Properties>

    <Appenders>
        <RollingFile
            name="RollingFileAppender"
            fileName="${LOG_HOME}/log.log"
            filePattern="${LOG_HOME}/log.log.%d{yyyy-MM-dd}.%i">
            <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="%d{DEFAULT} %p %t %c %L: %m%n"/>
            <Policies>
                <OnStartupTriggeringPolicy/>
                <!--<TimeBasedTriggeringPolicy/>-->
                <SizeBasedTriggeringPolicy size="256MB"/>
            </Policies>
            <DefaultRolloverStrategy max="8"/>
        </RollingFile>
    </Appenders>

    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="RollingFileAppender"/>
        </Root>
    </Loggers>
</Configuration>
{code}
And then I changed filePattern to
{code}
filePattern="${LOG_HOME}/log.log.%i">
{code}

Log file names still contain date.

  was:
The initial log4j2.xml file was
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" monitorInterval="60">
    <Properties>
        <Property name="LOG_HOME">./logs</Property>
    </Properties>

    <Appenders>
        <RollingFile
            name="RollingFileAppender"
            fileName="${LOG_HOME}/log.log"
            filePattern="${LOG_HOME}/log.log.%d{yyyy-MM-dd}.%i">
            <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="%d{DEFAULT} %p %t %c %L: %m%n"/>
            <Policies>
                <OnStartupTriggeringPolicy/>
                <!--<TimeBasedTriggeringPolicy/>-->
                <SizeBasedTriggeringPolicy size="256MB"/>
            </Policies>
            <DefaultRolloverStrategy max="8"/>
        </RollingFile>
    </Appenders>

    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="RollingFileAppender"/>
        </Root>
    </Loggers>
</Configuration>
{code}
And then I changed filePattern to
{code}
filePattern="${LOG_HOME}/log.log.%i">
{code}.

Log file names still contain date.


> dynamic configuration does not work for filePattern of RollingFile
> ------------------------------------------------------------------
>
>                 Key: LOG4J2-1964
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1964
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.8.2
>         Environment: JDK 1.7.80
>            Reporter: Xiaoshuang LU
>
> The initial log4j2.xml file was
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="INFO" monitorInterval="60">
>     <Properties>
>         <Property name="LOG_HOME">./logs</Property>
>     </Properties>
>     <Appenders>
>         <RollingFile
>             name="RollingFileAppender"
>             fileName="${LOG_HOME}/log.log"
>             filePattern="${LOG_HOME}/log.log.%d{yyyy-MM-dd}.%i">
>             <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
>             <PatternLayout pattern="%d{DEFAULT} %p %t %c %L: %m%n"/>
>             <Policies>
>                 <OnStartupTriggeringPolicy/>
>                 <!--<TimeBasedTriggeringPolicy/>-->
>                 <SizeBasedTriggeringPolicy size="256MB"/>
>             </Policies>
>             <DefaultRolloverStrategy max="8"/>
>         </RollingFile>
>     </Appenders>
>     <Loggers>
>         <Root level="INFO">
>             <AppenderRef ref="RollingFileAppender"/>
>         </Root>
>     </Loggers>
> </Configuration>
> {code}
> And then I changed filePattern to
> {code}
> filePattern="${LOG_HOME}/log.log.%i">
> {code}
> Log file names still contain date.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)