Using Log4j2 as target for Problem Determination Trace output
To use Log4j2 for Problem Determination Trace output, you must create log4j2.xml in the root of project, based on the following template:
<?xml version="1.0" encoding="UTF-8"?>
<!-- OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
<configuration status="WARN" monitorInterval="30">
<appenders>
<console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] - %m%n"/>
</console>
<RollingFile name="BTT_PDTrace_MUTE" fileName="/Users/jhh/Desktop/logs/pdtrace_mute.log" filePattern="/Users/jhh/Desktop/logs/pdtrace_mute-%d{yyyy-MM-dd}-%i.log">
<ThresholdFilter level="FATAL"/>
<PatternLayout pattern=" %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10240 KB"/>
</Policies>
</RollingFile>
<RollingFile name="BTT_PDTrace_DIRECT" fileName="/Users/jhh/Desktop/logs/pdtrace_direct.log" filePattern="/Users/jhh/Desktop/logs/pdtrace_direct-%d{yyyy-MM-dd}-%i.log">
<Filters>
<ThresholdFilter level="INFO"/>
<ThresholdFilter level="WARN" onMatch="DENY" onMismatch="NEUTRAL"/>
</Filters>
<PatternLayout pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] - %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10240 KB"/>
</Policies>
</RollingFile>
</appenders>
<loggers>
<root level="all">
<appender-ref ref="Console"/>
<appender-ref ref="BTT_PDTrace_MUTE"/>
<appender-ref ref="BTT_PDTrace_DIRECT"/>
</root>
</loggers>
</configuration>
To use Log4j2 for Problem Determination Trace output, copy the Log4j2 jar files to the library path. The following table details the jar files that are required in the library path depending on the version of Java that is installed in the server runtime environment.
Java version in server runtime environment
Log4j2 jar files required in library path
Java 1.6
log4j-api-2.0.1.jar
log4j-core-2.0.1.jar
Java 1.7 or higher
log4j-api-2.11.1.jar
log4j-core-2.11.1.jar
See also:
This site works best with JavaScript enabled