Log4j2 Configuration

Configuration

The default Log4j2 configuration writes log output to 3 files:

Log file Description
app.log The main application log with information about the startup/shutdown process and with information about errors.
transactions.log The transactions log containing 3-D Secure protocol messages, except preparation messages, exchanged with the Directory Server and the ACS.
preq-pres.log The preparation request/response log containing the 3-D Secure protocol preparation messages exchanged with the Directory Server.

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?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}/app.log" filePattern="${log-path}/app-%d{yyyy-MM-dd}.log">
      <PatternLayout>
        <pattern>
          [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%X{transaction.id}] %c{1} - %msg%n
        </pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
      </Policies>
    </RollingFile>
    <RollingFile name="Preparation-Request-Appender" fileName="${log-path}/preq-pres.log"
                 filePattern="${log-path}/preq-pres-%d{yyyy-MM-dd}.log">
      <PatternLayout>
        <pattern>
          [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%X{transaction.id}] %c{1} - %msg%n
        </pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
      </Policies>
    </RollingFile>
    <RollingFile name="Transaction-Message-Appender" fileName="${log-path}/transactions.log"
                 filePattern="${log-path}/transactions-%d{yyyy-MM-dd}.log">
      <PatternLayout>
        <pattern>
          [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%X{transaction.id}] %c{1} - %msg%n
        </pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
      </Policies>
    </RollingFile>
  </Appenders>
 
  <Loggers>
    <Root level="info">
      <AppenderRef ref="App-Appender"/>
    </Root>
 
    <!-- define Preparation Request/Response logger -->
    <Logger additivity="false" name="com.netcetera.nca3dss.domain.logger.PreparationRequestResponseLogger">
      <AppenderRef ref="Preparation-Request-Appender" />
    </Logger>
    <!--Logger for all other transactions-->
    <Logger additivity="false" name="com.netcetera.nca3dss.domain.logger.TransactionMessageLogger">
      <AppenderRef ref="Transaction-Message-Appender" />
    </Logger>
 
  </Loggers>
</Configuration>

Mapped Diagnostic Context (MDC)

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

Exposed info is the 3DS Server Transaction ID.

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

%X{transaction.id}

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 Server Configuration Properties which specifies the location of the log4j configuration.