日志记录与调试 [英] Logging vs. Debugging

查看:134
本文介绍了日志记录与调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我已经继承了一个旨在在本地和远程设备之间创建即时连接的Web应用程序。最近有大量移动部件:应用程序本身已经发生了显着变化;开发工具链刚刚更新;本地和远程设备都已被修改以支持这些更改。



明亮的一面是它有一个合理的日志记录系统,将调试消息写入文件,它将记录文件和实时用户屏幕。我有机会重新整理日志/调试机制。



示例:




  • 所有邮件均为时间戳,并带有严重性级别。

  • 日志用于客户。

  • 任何识别问题的日志都会提示解决方案。

  • 调试用于开发人员和技术人员支持。

  • 调试表示生成它们的功能和/或行。

  • 客户可以即时调整调试级别要设置详细程度。



问题:一个消费者,生成有用的日志和调试?






编辑 , 谢谢!澄清一点:我对 要记录的内容,格式,更感兴趣,以及这样做的原因 - 比具体的工具。 >

你看到的最好的日志是什么,使他们最有帮助?



感谢您的帮助!

解决方案

使用任何日志框架完成绝对最有价值的事情是一键式工具收集所有日志,并将其发送给我,即使应用程序部署在属于客户的计算机上。



在要记录的内容上做出很好的选择,以便您可以大致跟随您的应用程序中的主要路径。



作为框架,我使用了标准(log4net,log4java,log4c ++)



不要实现自己的日志框架,当已经有一个很好的开箱即用的。大多数人只是重塑轮子。


Background: I've inherited a web application that is intended to create on-the-fly connections between local and remote equipment. There are a tremendous number of moving parts recently: the app itself has changed significantly; the development toolchain was just updated; and both the local and remote equipment have been "modified" to support those changes.

The bright side is that it has a reasonable logging system that will write debug messages to a file, and it will log to both the file and a real-time user screen. I have an opportunity to re-work the entire log/debug mechanism.

Examples:

  • All messages are time-stamped and prefixed with a severity level.
  • Logs are for the customer. They record the system's responses to his/her requests.
  • Any log that identifies a problem also suggests a solution.
  • Debugs are for developers and Tech Support. They reveal the system internals.
  • Debugs indicate the function and/or line that generated them.
  • The customer can adjust the debug level on the fly to set the verbosity.

Question: What best practices have you used as a developer, or seen as a consumer, that generate useful logs and debugs?


Edit: Many helpful suggestions so far, thanks! To clarify: I'm more interested in what to log: content, format, etc.--and the reasons for doing so--than specific tools.

What was it about the best logs you've seen that made them most helpful?

Thanks for your help!

解决方案

The absolutley most valueable thing done with any logging framework is a "1-click" tool that gathers all logs and mail them to me even when the application is deployed on a machine belonging to a customer.

And make good choices at what to log so you can roughly follow the main paths in your application.

As frameworks I've used the standards (log4net, log4java, log4c++)

do NOT implement your own logging framework, when there already is a good one out-of-the-box. Most people who do just reinvent the wheel.

这篇关于日志记录与调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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