WAS 服务器日志与跟踪日志
在此链接http://en.wikipedia.org/wiki/Tracing_(software)他们指出了服务器日志和跟踪日志之间的差异。作为开发人员,我一直对服务器日志感到满意,而从不需要跟踪日志。什么情况需要查看跟踪日志?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 @bkail 提到的,WebSphere Application Server 的内置服务器跟踪通常用于 IBM 支持。它通常粒度太细,并且与 IBM 的封闭源代码紧密耦合,无法供客户使用。
然而,跟踪日志也可用于应用程序支持。如果您的应用程序使用
java.lang. util.logging
,这些日志事件将被写入WAS的日志文件(例如SystemOut.log
、trace.log
)。写入SystemOut.log
的日志消息 (Level.CONFIG
及更高版本)通常适用于系统管理员。写入trace.log
的日志消息 (Level.FINE
及更低)是通常用于开发人员或故障排除的消息,调试目的;这些消息可能与代码紧密结合,或者包含在故障排除情况下有用的大量诊断信息。一般来说,您只需要 启用跟踪,因为这种类型的大量日志记录可能成本高昂,并且可能会影响应用程序的性能。作为开发人员,您应该对面向系统管理员的日志记录和面向开发人员或故障排除的日志记录(跟踪)进行一流的区分。日志记录是与系统管理员沟通的一种很好的方法,并且对于故障排除非常有用,但是每个用例都应该以不同的方式处理。这是日志记录 API(包括 java.util.logging)提供多个 日志记录级别。 您引用的文章似乎在区分日志记录和跟踪方面做得很好(其中在 WAS 中转换为
SystemOut.log
和trace.log
)。 IBM 的文档 还很好地概述了这些差异。As @bkail mentions, WebSphere Application Server's built-in server tracing is typically for IBM support. It is generally too fine-grained and tightly coupled with IBM's closed source code to be of use to customers.
However, there are also uses of the trace logs for application support as well. If your application utilizes
java.util.logging
, these log events will be written to WAS's log files (e.g.SystemOut.log
,trace.log
). The log messages written toSystemOut.log
(Level.CONFIG
and higher) are typically intended for system administrators. Log messages written totrace.log
(Level.FINE
and lower), on the other hand, are messages that are typically intended for developers or troubleshooting and debugging purposes; these messages may be tightly coupled with the code or contain extensive diagnostic information useful in troubleshooting situations. Generally, you only want to enable tracing during troubleshooting or development, as this type of extensive logging can be expensive and potentially impact the performance of your applications.As a developer, you should make a first-class distinction between logging intended for your system administrators and logging (tracing) intended for developers or troubleshooting. Logging is a great method for communicating with system administrators and can be an invaluable for troubleshooting, but each of these use cases should be handled differently. This is one of the primary reasons that logging APIs (including
java.util.logging
) provide multiple logging levels. The article you referenced seems to do a great job distinguishing between logging and tracing (which translates toSystemOut.log
andtrace.log
in WAS). IBM's documentation also provides a good overview of the differences.Trace 主要由 IBM 的 WebSphere Application Server 支持人员使用。该产品的客户很少会自己启用跟踪。
Trace is primarily used by WebSphere Application Server support at IBM. Customers of that product would very rarely enable trace themselves.