Log4j2 Configuration

Configuration

The default Log4j2 configuration writes log output to 2 files:

Log file Description
app.log The main application log with information about the startup/shutdown process and with information about errors.
audit.log The audit log containing the actions taken by the user for managing the configuration via the Admin application.

The log output is formatted according to a conversion pattern defined using a PatternLayout.

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
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="60" schema="Log4J-config.xsd">
  <Properties>
    <Property name="log-path">logs</Property>
  </Properties>
  <Appenders>
    <RollingFile name="App-Appender" fileName="${log-path}/admin-ui.log" filePattern="${log-path}/admin-ui-%d{yyyy-MM-dd}.log">
      <PatternLayout>
        <pattern>
          [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
        </pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
      </Policies>
    </RollingFile>
    <RollingFile name="Audit-Appender" fileName="${log-path}/audit.log" filePattern="${log-path}/audit-%d{yyyy-MM-dd}.log">
      <PatternLayout>
        <pattern>
          [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%X{accountId}] [%X{sessionId}] [%X{remoteAddress}] - %msg%n
        </pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
      </Policies>
    </RollingFile>
  </Appenders>
 
  <Loggers>
    <Root level="info">
      <AppenderRef ref="App-Appender"/>
    </Root>
 
    <!-- define audit logger -->
    <Logger name="AUDIT" additivity="false">
      <AppenderRef ref="Audit-Appender" />
    </Logger>
  </Loggers>
</Configuration>

Mapped Diagnostic Context (MDC)

The 3DS Admin application uses Mapped Diagnostic Context (MDC) to expose additional information available for log output.

Exposed info is the logged user Account ID, the logged user Session ID and the logged user remote address.

You can use information exposed via MDC in your log output by using the following conversion pattern:

%X{accountId}
%X{sessionId}
%X{remoteAddress}

For more details about conversion patterns please refer to the Log4j PatternLayout documentation.

Use your own configuration

Although not recommended, you can use your own Log4j configuration.

To do so, you have to override the logging.config property in 3DS Admin Configuration Properties which specifies the location of the log4j configuration.