How to log exception stacktrace for Spring's SimpleMappingExceptionResolver
I'm working on a project where the exception handling was created by someone else who is no longer here to help.
They've crea开发者_如何学Pythonted the following bean which catches all uncaught exceptions and forwards to a JSP View.
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<map>
<entry key="java.lang.Exception" value="error"/>
</map>
</property>
<property name="defaultErrorView" value="error" />
</bean>
It works fine, but what if I want to get a hold of the exception thrown and report it in our logs? How do I forward this to a Java class instead of a View?
Set the properties for warnLogCategory
. See the class Javadoc.
精彩评论