Which logger do I list in my log4j.xml to trap unhandled struts 2 exceptions?
I have the following code declared in my struts.xml:
<package name="default" extends="struts-default">
<interceptor-stack name="defaultStack">
<interceptor-ref name="timer"/>
<interceptor-ref name="logger"/>
<interceptor-ref name="exception">
<param name="logEnabled">true</param>
<param name="logCategory">error.unhandled</param>
<param name="logLevel">WARN</param>
</interceptor-ref>
</interceptor-stack>
</package>
In my log4j.xml file, I have the following logger declared:
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%p [%c] - %C{1}.%M(%L) | %m%n"/>
</layout>
</appender>
<logger name="error.unhandled">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE" />
</logger>
However, when Struts throws an exception, it is not properly logged by log4j. I know that my log4j.xml is being parsed correctly since I can manually create a java class with a logger called "error.unhandled" and write ERROR level messages directly to it. A colleague also suggested that I should try trapping the log4j.logger.error.unhandled logger but that did not work either.
Which logger does Struts 2 use for the exception interceptor?