【发布时间】:2020-09-19 13:28:03
【问题描述】:
2 个问题:
- e.printStackTrace(System.out) 和 e.printStackTrace() 有什么区别?
- 如果我想打印堆栈,使用 logger.error("", e) 将 e.printStackTrace(System.out) 和 e.printStackTrace() 替换为 log4j 是否安全(从生产的角度来看)在我的日志文件中跟踪?
【问题讨论】:
-
Throwable.printStackTrace()打印到System.err。 -
Throwable.printStackTrace(System.out) 是做什么的? @JohannesKuhn
-
您阅读过 API 文档吗?而是将其打印到提供的非默认输出
System.out。
标签: java exception logging log4j