简体   繁体   English

我如何将堆栈跟踪从我的Java类打印到servlet

[英]How i can print stacktrace from my java class to a servlet

i want to print the stack trace on my jsp page. 我想在我的jsp页面上打印堆栈跟踪。 I am calling a method from my servlet for sending a mail but when some issue occurs it still executes my next line.The next i have called a success page It always goes to that page \\ 我正在从servlet调用一种发送邮件的方法,但是当出现问题时,它仍然执行我的下一行。下一个我称为成功页面,它总是转到该页面\\

Use a log framework such as slf4j or log4j instead. 请改用slf4j或log4j之类的日志框架。 Displaying the stack trace in your results is not helpful to the end user and may be a security risk. 在结果中显示堆栈跟踪对最终用户没有帮助,并且可能存在安全风险。 Catch the appropriate exceptions and log them, or use framework features (as provided by Spring and other frameworks) to automatically log exceptions for you and return an error page. 捕获适当的异常并记录它们,或使用框架功能(由Spring和其他框架提供)自动为您记录异常并返回错误页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM