Spring Boot自定义错误页面堆栈跟踪 [英] Spring Boot Custom Error Page Stack Trace
本文介绍了Spring Boot自定义错误页面堆栈跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在几个地方都找到了如何使用Spring Boot创建自定义错误页面的方法,但是我似乎无法弄清楚如何使它显示堆栈跟踪.
I have found on several locations how to use Spring boot to make a custom error page but I cannot seem to figure out how to make it show a stack trace.
这就是我所拥有的:
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/WEB-INF/jsp/app/404.jsp");
ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/WEB-INF/jsp/app/500.jsp");
container.addErrorPages(error404Page, error500Page);
}
};
}
有什么想法可以解决这个问题或如何获得堆栈跟踪信息吗?
Any ideas how I could figure this out or how to get the stack trace to begin with?
推荐答案
您现在不能立即使用Spring Boot提供的功能.我想在1.3中合并一个拉请求应该给您足够的背景信息来找出缺失的部分.
You can't right now using what Spring Boot offers out-of-the-box. There is a pull request that I'd like to merge in 1.3 which should give you enough context to figure out the missing bits.
这篇关于Spring Boot自定义错误页面堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文