您的采伐哲学是什么? [英] What’s your logging philosophy?

查看:94
本文介绍了您的采伐哲学是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jeff Atwood询问:您的日志记录哲学是什么?所有代码都应该被.logthis().logthat()调用?还是您以某种方式注入日志?"

As Jeff Atwood asked: "What’s your logging philosophy? Should all code be littered with .logthis() and .logthat() calls? Or do you inject logging after the fact somehow?"

推荐答案

我的日志记录原理很容易概括为四个部分:

My logging philosophy is pretty easily summarized in four parts:

审核或业务逻辑记录

记录那些需要记录的内容.这来自于应用程序需求,并且可能包括记录对任何数据库所做的每项更改(如在许多财务应用程序中一样)或记录对数据的访问(卫生行业可能需要满足行业法规)

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.

安全日志记录

记录涉及安全性的用户操作和与外部系统的交互.对于确定攻击者在攻击后如何破坏系统很有用,但也可以与入侵检测系统配合使用以检测新的或正在进行的攻击.<​​/p>

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.

这篇关于您的采伐哲学是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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