Logging

Contents

This section describes configuration files and for logging in Enonic XP

Standard logging

XP_HOME/config/logback.xml

This logging is used for the XP server and all applications running on it. By default, the logback configuration is set to log to both console and file, but you can customize it as needed.

Default logback file
<configuration scan="true" scanPeriod="60 seconds"> (1)
  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> (2)
    <file>${xp.home}/logs/server.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
      <fileNamePattern>${xp.home}/logs/server.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
      <maxFileSize>100MB</maxFileSize>
      <maxHistory>7</maxHistory>
      <totalSizeCap>3GB</totalSizeCap>
    </rollingPolicy>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <withJansi>true</withJansi>
    <encoder>
      <pattern>%date{ISO8601} %highlight(%-5level) %cyan(%logger{36}) - %msg%n</pattern>
    </encoder>
  </appender>

  <root level="info"> (3)
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="FILE"/>
  </root>

  <logger name="Events.Service" level="WARN" additivity="false">
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="FILE"/>
  </logger>

  <logger name="Events.Bundle" level="WARN" additivity="false">
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="FILE"/>
  </logger>
</configuration>
1 Configuration

scan: If true sets the file in scan mode and will reconfigure itself when the configuration file changes.

scanPeriod: Sets the scanning period. Values can be specified in units of miliseconds, seconds, miniutes or hours. Defaults to every minute. If no unit of time is specified, milisceonds will be used.

2 Appender creates a new logging component

class Points to what java class you want handle your logging

Possible classes:

ConsoleAppender: "ch.qos.logback.core.ConsoleAppender" ConsoleAppender
FileAppender: "ch.qos.logback.core.FileAppender" FileAppender
RollingFileAppender: "ch.qos.logback.core.rolling.RollingFileAppender" RollingFileAppender

3 Root Configuring the root logger.

level Can be set on <logger> and <root> to specify the importance of the message logged.

values: "DEBUG", "INFO", "WARN", "ERROR", "ALL", "OFF" or "TRACE" See: Logger, Root for additional information

Additional information can be found here: Logback documentation

Audit logging

XP_HOME/config/com.enonic.xp.audit.cfg

Configure the audit log feature.

Sample audit config file
enabled = true
outputLogs = false
ageThreshold =
enabled

Set to false to disable the creation of audit log entries. Default: true.

outputLogs

Set to true to log the stored audit log entries. Default: false.

ageThreshold

Age of data to be removed by a cleanup task. The format is based on the ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours. Nothing will be removed by default, duration must me set.

Individual applications may have their own audit log configuration, which can be found in the respective application configuration file. If the common enabled property is set to false, application-specific audit log settings will not have any effect.

Contents

Contents