我应该打印异常堆栈跟踪? [英] Should I Print the Exception Stack Trace?

查看:266
本文介绍了我应该打印异常堆栈跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何低效是它得到的堆栈跟踪的一个例外?我知道这是昂贵的,但如何昂贵?如果他们绝对的没有的在生产环境中使用?

How inefficient is it to get the stack trace for an exception? I know it's costly, but how costly? Should they definitely not be used in production environment?

推荐答案

在生产环境中,这是有帮助的的登录的堆栈跟踪,以便用户可以找到它时,他们联系技术支持。打印堆栈跟踪到位的理解(由典型用户)消息,应尽量避免。

In a production environment, it's helpful to log the stack trace so the user can find it when they contact tech support. Printing stack trace in place of an understandable (by the typical user) message should be avoided.

您不应该关心的是code特殊块的效率。错误恢复是最重要的事情在这里。

You shouldn't be concerned with the efficiency of exceptional blocks of code. Error recovery is the most important thing here.

这篇关于我应该打印异常堆栈跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆