Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

log errors with stack traces spring

@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;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #log #errors #stack #traces #spring
ADD COMMENT
Topic
Name
2+5 =