开发者

How to log exception stacktrace for Spring's SimpleMappingExceptionResolver

开发者 https://www.devze.com 2023-01-26 16:18 出处:网络
I\'m working on a project where the exception handling was created by someone else who is no longer here to help.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消