You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Lucas Ventura Carro (JIRA)" <ji...@apache.org> on 2017/06/01 13:35:04 UTC

[jira] [Updated] (LOG4J2-1928) RollingRandomAccessFileAppender with DirectWriteRolloverStrategy requires a fileName

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

Lucas Ventura Carro updated LOG4J2-1928:
----------------------------------------
    Description: 
Following the docs about [RollingRandomAccessFileAppender|https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingRandomAccessFileAppender] with a [DirectWrite rollover|https://logging.apache.org/log4j/2.x/manual/appenders.html#RolloverStrategies], the config should be:
{code}
<RollingRandomAccessFile append="true" filePattern="application.log.%i" name="json-log">
    <filters>
        <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
    </filters>
	<PatternLayout>
		<Pattern>%m%n</Pattern>
	</PatternLayout>
    <Policies>
        <SizeBasedTriggeringPolicy size="10 MB"/>
    </Policies>
    <DirectWriteRolloverStrategy maxFiles="10"/>
</RollingRandomAccessFile>
{code}

But then console shows:
{noformat}
2017-06-01 14:31:04,396 main ERROR No filename was provided for FileAppender with name json-log
2017-06-01 14:31:04,406 main ERROR Null object returned for RollingRandomAccessFile in appenders.
2017-06-01 14:31:04,417 main ERROR Unable to locate appender "json-log" for logger config "root"
{noformat}

If adding a {{fileName}} parameter, the logger can be used but the file is not rolling (same as LOG4J2-1906).

  was:
Following the docs about [RollingRandomAccessFileAppender|https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingRandomAccessFileAppender] with a [DirectWrite rollover|https://logging.apache.org/log4j/2.x/manual/appenders.html#RolloverStrategies], the config should be:
{code}
<RollingRandomAccessFile append="true" filePattern="application.log.%i" name="json-log">
    <filters>
        <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
    </filters>
	<PatternLayout>
		<Pattern>%m%n</Pattern>
	</PatternLayout>
    <Policies>
        <SizeBasedTriggeringPolicy size="10 MB"/>
    </Policies>
    <DirectWriteRolloverStrategy maxFiles="10"/>
</RollingRandomAccessFile>
{code}

But then console shows:
{noformat}
2017-06-01 14:31:04,396 main ERROR No filename was provided for FileAppender with name json-log
2017-06-01 14:31:04,406 main ERROR Null object returned for RollingRandomAccessFile in appenders.
2017-06-01 14:31:04,417 main ERROR Unable to locate appender "json-log" for logger config "root"
{noformat}

Later, the file is not rolling, the same as LOG4J2-1906.


> RollingRandomAccessFileAppender with DirectWriteRolloverStrategy requires a fileName
> ------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1928
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1928
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.8.1
>            Reporter: Lucas Ventura Carro
>
> Following the docs about [RollingRandomAccessFileAppender|https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingRandomAccessFileAppender] with a [DirectWrite rollover|https://logging.apache.org/log4j/2.x/manual/appenders.html#RolloverStrategies], the config should be:
> {code}
> <RollingRandomAccessFile append="true" filePattern="application.log.%i" name="json-log">
>     <filters>
>         <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
>     </filters>
> 	<PatternLayout>
> 		<Pattern>%m%n</Pattern>
> 	</PatternLayout>
>     <Policies>
>         <SizeBasedTriggeringPolicy size="10 MB"/>
>     </Policies>
>     <DirectWriteRolloverStrategy maxFiles="10"/>
> </RollingRandomAccessFile>
> {code}
> But then console shows:
> {noformat}
> 2017-06-01 14:31:04,396 main ERROR No filename was provided for FileAppender with name json-log
> 2017-06-01 14:31:04,406 main ERROR Null object returned for RollingRandomAccessFile in appenders.
> 2017-06-01 14:31:04,417 main ERROR Unable to locate appender "json-log" for logger config "root"
> {noformat}
> If adding a {{fileName}} parameter, the logger can be used but the file is not rolling (same as LOG4J2-1906).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)