Uploaded image for project: 'OpenICF'
  1. OpenICF
  2. OPENICF-1638

RCS logback.xml should be configured for rolling log files with max age/size over a single ever growing file by default

    XMLWordPrintable

    Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.5.20.0, 1.5.19.6
    • None

      Description

      Currently the appender class in .../openicf/lib/framework/logback.xml is set to

      ch.qos.logback.core.FileAppender 
      

      meaning the log file will never rotate and grow in size indefinitely.

      For Production running, this is sub optimal.

      The improvement request is to change this to

      ch.qos.logback.core.rolling.RollingFileAppender
      

      to ensure log file rotate at a regular cadence for optimal running/archiving by default/out of the box/on install.

      In addition both maxHistory should be configured and totalSizeCap to ensure old logs are removed and log files remain a manageable size. As an example here is the default for SERVER-FILE

      <appender name="SERVER-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
              <file>logs/ConnectorServer.log</file>
              <append>true</append>
              <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                  <fileNamePattern>logs/ConnectorServer-%d{yyyyMMdd}.log</fileNamePattern>
              </rollingPolicy>
              <encoder>
                  <pattern>%date{"MMM dd, yyyy h:mm:ss a"} %-5level %logger{35}: %msg %n</pattern>
              </encoder>
          </appender>
      

      Here is an example with the rolling appender configured with maxHistory set to 30 days and totalSizeCap set to 1GB

      <appender name="SERVER-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
              <file>logs/ConnectorServer.log</file>
              <append>true</append>
              <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                  <fileNamePattern>logs/ConnectorServer-%d{yyyyMMdd}.log</fileNamePattern>
                  <!-- keep 30 days' worth of history capped at 1GB total size -->
                  <maxHistory>30</maxHistory>
                  <totalSizeCap>1GB</totalSizeCap>
              </rollingPolicy>
              <encoder>
                  <pattern>%date{"MMM dd, yyyy h:mm:ss a"} %-5level %logger{35}: %msg %n</pattern>
              </encoder>
          </appender>
      

        Attachments

          Activity

            People

            gael Gael Allioux
            shokard Darinder Shokar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: