I am sure this is a simple fix but can't for the life of me figure out why. I am getting random NPEs and have log4j (2.0.2) logging the error, however despite having the %ex in my log4j configuration file, it prints no stack trace.
11-01-2019 02:39:33.212 [Thread-307] ERROR AlarmParse.ProcessAlarm: java.lang.NullPointerException -
Log4j2 configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration monitorInterval="30" status="INFO">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg - %ex%n"/>
</Console>
<File name="MyFile" fileName="G:/iMCAlarmParse/logs/AppLog.log">
<PatternLayout pattern="%d{MM-dd-yyyy HH:mm:ss.SSS} [%t] %-5level %c{2}: %msg - %ex%n"/>
</File>
Java:
try {
//<Many sequential class calls>
} catch (Exception e) {
log4j.error(e);
}