Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1928

RollingRandomAccessFileAppender with DirectWriteRolloverStrategy requires a fileName

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.9.0
    • Component/s: None
    • Labels:
      None

      Description

      Following the docs about RollingRandomAccessFileAppender with a DirectWrite rollover, the config should be:

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

      But then console shows:

      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"
      

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

        Attachments

          Activity

            People

            • Assignee:
              ralph.goers@dslextreme.com Ralph Goers
              Reporter:
              lucasvc Lucas Ventura Carro
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: