Skip to content

Logging (logback-spring.xml)

Easit Process Runner uses Spring Boots Logback Extension for its logging. This file (logback-spring.xml) holds all configuration needed for that extension and here we can, for example, set the number of days log files should be saved, the name of the log file, total size of "log archive" and more.

You can change / update the settings in this file "on the fly", no restart of application need, as the application looks for changes each 60 seconds.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  <?xml version="1.0" encoding="UTF-8"?>
  <configuration scan="true" scanPeriod="60 seconds">
    <property name="LOGS" value="./logs" />
    <property name="FILE_NAME" value="EasitProcessRunner" />
    <property name="LOG_TOTAL_SIZE_CAP" value="10" />
    <property name="LOG_MAX_HISTORY" value="30" />
    <property name="LOG_LAYOUT_PATTERN" value="%d{yyyy-MM-dd} - %d{HH:mm:ss.SSS} - %-5p - %message - %thread - %class{1.}%n%throwable" />
    <appender name="ROLLING_FILE"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
      <file>${LOGS}/${FILE_NAME}.log</file>
      <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
        <Pattern>
          ${LOG_LAYOUT_PATTERN}
        </Pattern>
      </encoder>
      <rollingPolicy
          class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>${LOGS}/${FILE_NAME}.%d{yyyy-MM-dd}.log</fileNamePattern>
        <totalSizeCap>${LOG_TOTAL_SIZE_CAP}GB</totalSizeCap>
        <maxHistory>${LOG_MAX_HISTORY}</maxHistory>
      </rollingPolicy>
    </appender>
    <root level="INFO">
      <appender-ref ref="ROLLING_FILE" />
    </root>
  </configuration>

Settings of interest

LOGS

Path to where the logs for EPR will be written. This path can be relative, by starting the path with ./, or absolute, by starting the path with driveletter://. When starting with ./ the path is relative to catalina.base, meaning the tomcat directory in the instance installation directory.

FILE_NAME

Name of the log file. .log will be appended to this value and when logs a rolled todays date will also be appended to the value.

  • Today's log = FILE_NAME.log
  • Yesterdays log = FILE_NAME.YesterdaysDate.log

LOG_TOTAL_SIZE_CAP

This value controls the total size of all archive log files. Oldest archives are deleted asynchronously when the total size cap is exceeded. The totalSizeCap property requires maxHistory property to be set as well. Moreover, the "max history" restriction is always applied first and the "total size cap" restriction applied second.

LOG_MAX_HISTORY

This value controls the maximum number of archive files to keep, asynchronously deleting older files. For example, we start each line with todays date (%d{yyyy-MM-dd}) and the timestamp (%d{HH:mm:ss.SSS}) and we separate each "column" in the log file with ' - '.

LOG_PATTERN_FILE

This value specifies how each message from the application is outputted to the log.

Further reading

You can find more information about logging at Spring documentation - Logging and LogBack Manual.