I'm having a problem printing the stacktrace to my log file. Log4j.properties:
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/var/log/app/application.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
log4j.rootLogger=warn, file
log4j.logger.com.app=info, file
log4j.additivity.com.app=false
when I log an exception like this in my class UserGuard.java:
} catch (Exception e) {
log.error("Uncaught error", e);
response.setEntity(new StringRepresentation(" "));
response.setStatus(Status.SERVER_ERROR_INTERNAL);
}
This results in my application.log :
2011-12-28 07:30:03 UserGuard [ERROR] Uncaught error
java.lang.NullPointerException
No stack trace shown. This is really annoying. Thanks!
Tried with same pom.xml and same log4j.properties on another machine and works ok. Should I think that the problem is my java version?