📜  使用堆栈跟踪记录错误 spring - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:03.690000             🧑  作者: Mango

代码示例1
@Component
public class AppExceptionResolver extends AbstractHandlerExceptionResolver
{
    private static final Logger logger = LoggerFactory.getLogger(AppExceptionResolver.class.getSimpleName());

    @Override
    protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
    {
        logger.error("Application error in: [" + ex.getClass().getName() + "]", ex);
        return null;
    }
}