I wrote a web application with various frameworks (jsf, Spring, Hibernate), and my log library is Logback and slf4j.
At the moment, I cannot display excluded exceptions (e.g. NullPointers) in the log file.
This is my logBack.xml file
<configuration debug="true">
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${CATALINA_HOME}/logs/jsfDemo.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>jsfDemo.%d{yyyy-MM-dd}.log.zip</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="FILE" />
</root>
</configuration>
when I execute these few lines of code with uc = null
public void nullPointerMethod(UserCredential uc){
LOG.debug(">>login(uc)");
if(uc == null){
throw new NullPointerException();
}else{
}
LOG.debug("<<login(uc)");
}
in logFile I only see
>>login(uc)
but I want to see stackTrace for NullPointer. What's wrong?
source
share