Configure logs at a system level

Contrast collects multiple log files that log events and messages. A SuperAdmin, ServerAdmin or System Administrator can access system settings and set log levels:

  1. In system settings, select Log level in the left navigation.

  2. The current setting is displayed. Click on that setting to open a drop-down menu where you can change the log level setting at a system level.

You can also configure the log4j2.xml file used to host the Log4j configuration that is packaged in the Contrast application. You can view more details about Log4j custom levels.

Caution

Contact support before making any changes to this file to ensure the formatting is syntactically correct. A server restart is not required if the changes are entered correctly.

  1. Find the file under $CONTRAST_HOME/data/conf.

  2. The first parameter of the file below is a monitor interval that refreshes the settings based on the variable defined. By default, Contrast checks every 60 seconds and refreshes the logging configuration.

    <Configuration monitorInterval="60">
  3. Edit the file as needed.

    Tip

    Read more about appenders and delivering LogEvents in the Log4j documentation. Contrast predominantly makes use of the Rolling File Appender, which is an OutputStreamAppender that writes to the file named in the fileName parameter, and rolls the file over according to the TriggeringPolicy and the RolloverPolicy.

    Here is a sample file of the appenders for contrast.log. It shows a daily appender with a 1GB max file size policy and no more than 15 files of rollover. This appender also compresses the file and renames it daily.

    <RollingFile name="DAILY" fileName="${contrast.logs.dir}/logs/contrast.log"
                filePattern="${contrast.logs.dir}/logs/contrast.%d.%i.log.gz" immediateFlush="true">
        <PatternLayout>
            <Pattern>%d{ddMMyy HH.mm.ss,SSS} {%X{session.id}} {%X{user.name}} {%X{remote.addr}} %-5p (%F:%L) %m%n
            </Pattern>
        </PatternLayout>
        <Policies>
            <TimeBasedTriggeringPolicy/>
            <SizeBasedTriggeringPolicy size="1 GB"/>
        </Policies>
        <DefaultRolloverStrategy max="15"/>
    </RollingFile>

    The logger section of the file defines which Java packages should log to a specific Appender and at a given log level.