你的伐木哲学是什么?

作为Jeff Atwood asked:“你的采伐哲学是什么?所有的代码都应该是用.logthis()和.logthat()调用的吗?还是在事实之后注入日志记录?
我的伐木哲学很容易总结为四部分:

审计或业务逻辑记录

Log those things that are required to be logged. This comes from the application requirements, and may include logging every change made to any database (as in many financial applications) or logging accesses to data (as may be required in the health industry to meet industry regulations)

As this is part of the program requirements many do not include it in their general discussions of logging, however there is overlap in these areas, and for some applications it is useful to consider all logging activities together.

程序记录

Messages which will help developers test and debug the application, and more easily follow the data flow and program logic to understand where implementation, integration, and other errors may exist.

In general this logging is turned on and off as needed for debugging sessions.

性能记录

Add later logging as needed to find and resolve performance bottlenecks and other program issues which aren’t causing the program to fail, but will lead to better operation. Overlaps with Program logging in the case of memory leaks and some non-critical errors.

安全记录

Logging user actions and interactions with external systems where security is a concern. Useful for determining how an attacker broke a system after an attack, but may also tie into an intrusion detection system to detect new or ongoing attacks.

http://stackoverflow.com/questions/44554/what-s-your-logging-philosophy

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:你的伐木哲学是什么?