VERIFIED SOLUTION i

How to limit the size of log files in Spectrum

Operating System: Windows, Linux, UNIX
    
Product affected: Spectrum™ Technology Platform

Versions: 8 SP3, 9 SP3, 10 SP1, 11 SP1
 
There are two main log files in Spectrum:  wrapper.log and server.log. Depending on the level of detail being logged, these files can consume significant amounts of disk space. It can be desirable to limit the size of these log files.

The behavior of the wrapper.log file is controlled by the <Spectrum install>/server/bin/wrapper/wrapper.conf file.  Edit these two properties to restrict the amount of hard disk space the wrapper.log file will consume:
  • wrapper.logfile.maxsize
  • wrapper.logfile.maxfiles

The wrapper.logfile.maxsize property controls how large the wrapper.log file can grow before it is rolled (e.g. to wrapper.log.1).  The default value of '0' disables log rolling and allows the file to grow unrestricted.  To change this, set the property to the maximum size of the file you want to allow.  For example:
  • wrapper.logfile.maxsize=50m
will cause the wrapper.log file to roll when it reaches 50 megabytes.

The wrapper.logfile.maxfiles property controls how many "rolled" files will be kept on the system before the oldest is recycled.  When the wrapper.log file reaches the wrapper.logfile.maxsize limit, it will be renamed to wrapper.log.n, where n is a number from 1 through wrapper.log.maxfiles.  The oldest log file will have the largest n value, i.e. wrapper.log.1 will contain more recent information than wrapper.log.10. 

The default value of '0' means that there is no limit to the number of rolled log files that will be kept on the hard disk.  Set this property to the number of rolled log files to keep on the system.  For example, this setting:
  • wrapper.logfile.maxfiles=3
would result in the files wrapper.log, wrapper.log.1, wrapper.log.2, and wrapper.log.3 being retained.

The behavior of the server.log file is controlled by the <Spectrum_install_location>/server/app/conf/log4j.xml file or the <Spectrum_install_location>/server/app/conf/logback.xml file, depending on the version of Spectrum that is installed. Spectrum 9 SP3 and later use logback.xml, while Spectrum 8 SP3 and earlier use log4j.xml. By default, Spectrum limits the size of the server.log file to 10 MB.  When the server.log file reaches that size, it is rolled over to server.log.1.  Only a single rolled file is maintained.  To change this, edit the appropriate XML file. 

In Spectrum 8 SP3 and earlier, the log4j.xml file has this collection of tags:
 
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
    <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
    <param name="File" value="../app/repository/logs/server.log"/>
    <param name="Append" value="true"/>
    <param name="MaxFileSize" value="10MB"/>
    <param name="MaxBackupIndex" value="1"/>

    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
    </layout>
    <filter class="com.pb.spectrum.platform.server.common.logging.LogFilter"/>
</appender>

The MaxFileSize and MaxBackupIndex attributes determine the maximum file size of server.log and how many rolled files will be kept on the system.

In Spectrum 9 SP3 and later, the logback.xml file contains this collection of tags:
 
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>../app/repository/logs/server.log</file>
    <encoder>
      <pattern>%d %-5p [%c{0}] %m%n</pattern>
    </encoder>
    <append>true</append>
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>10MB</maxFileSize>
    </triggeringPolicy>
    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>server.log.%i</fileNamePattern>
      <maxIndex>1</maxIndex>
    </rollingPolicy>
    <filter class="com.pb.spectrum.platform.server.common.logging.LogbackFilter"/>
</appender>

Modify the maxFileSize and maxIndex values to change the size and copies of the server.log file.

These changes will take effect when Spectrum is restarted.
UPDATED:  November 16, 2018