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

Configuring RollingRandomAccessFile with HTMLLayout does not work as expected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0-rc1
    • 2.0-rc2
    • Appenders, Layouts

    Description

      I'm trying to configure a rolling file appender to work with HTMLLayout:

      <RollingRandomAccessFile name="RollingFile"
          fileName="logs/app.html" filePattern="logs/app-%i-%d{yyyy-MM-dd-HH}.html">
          <HTMLLayout title="App log" locationInfo="true"/>
          <Policies>
          <TimeBasedTriggeringPolicy interval="12" />
          <SizeBasedTriggeringPolicy size="10 MB" />
          <OnStartupTriggeringPolicy />
          </Policies>
          <DefaultRolloverStrategy max="100" />
      </RollingRandomAccessFile>
      

      But the outcome is not as expected. The logs are not formatted in a nice table and when I open the log file as text the HTML header is missing.

      When I use FileAppender it works fine.

      <File name="FileAppender" fileName="logs/agent.html">
              <HTMLLayout title="Agent log" locationInfo="true" />
      </File>
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              litalk lital kornfeld
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: