Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article gives an example log configuration file and explains it roughly.

To activate this file, copy it to the directory containing all other configurations for tia Content Server Core and set the parameter logging.config with path and file name of this file.

Logging configuration for rolling log file

This example demonstrates how to set up tia Content Server for file logging.

...

Info

The default log file pattern is explained in this knowledge base article: /wiki/spaces/SUPPORT/pages/3661987841

The root tag is the main point to load these specifications. Here,

...

Info

The root log level can be set as well by application-wide parameter logging.level.root.

Example logging configuration file

Code Block
<configuration>
    <property name="LOG_PATH" value="./logs" />
    <!-- Log file name without extension: .log is added in appender -->
    <property name="LOG_FILE" value="tiaCSCore" /> 
    <property name="LOG_ARCHIVE" value="${LOG_PATH}/archive" />
    
    <appender name="FILE-ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_PATH}/${LOG_FILE}.log</file>

        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${LOG_ARCHIVE}/${LOG_FILE}.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
            <!-- each archived file, size max 10MB -->
            <maxFileSize>10MB</maxFileSize>
            <!-- total size of all archive files, if total size > 20GB, it will delete old archived file -->
            <totalSizeCap>20GB</totalSizeCap>
            <!-- 60 days to keep -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>

        <encoder>
		<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%32.32X{traceId}/%16.16X{spanId}] [%.-1p] [%20.20thread] %70.70(%30.30logger{10}.%M \(%4L\) ): %m%n</pattern>
        </encoder>
    </appender>

    <root level="ERROR">
        <appender-ref ref="FILE-ROLLING"/>
    </root>
</configuration>