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

Dates in filename for RollingRandomAccessFile appender

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Appenders
    • None

    Description

      The feature for using dates as part of the current logfile (by omitting the filename attribute and using the filepattern instead) has been implemented for RollingFileAppender (see LOG4J2-1101) but not for RollingRandomAccessFileAppender.

      The following config should work:

      <RollingRandomAccessFile name="Application" filePattern="logs/test.%d{yyyy-MM-dd-HH-mm}.log">
          <PatternLayout pattern="%d{DATE} [%p] %X{RequestId} (%t) %c: %m%n"/>
          <Policies>
              <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
          </Policies>
          <DirectWriteRolloverStrategy/>
      </RollingRandomAccessFile>
      

      Currently it emits

      ERROR No filename was provided for FileAppender with name Application

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jualoman Juan Loman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: