美文网首页
Pro_Apache_Log4j - 1. How Loggin

Pro_Apache_Log4j - 1. How Loggin

作者: 海德堡绝尘 | 来源:发表于2017-12-19 21:15 被阅读3次

Pro Apache Log4j Second Edition-How Logging Works

  • 1 bug-free
    It is a well-known fact that no software is bug-free. Therefore, we need
    to assume that application modules may malfunction from time to time, and we need some mechanism to trace what is going wrong.

    众所周知,没有软件是没有缺陷的。所以我们需要
    假设应用模块可能会不时发生故障,我们需要一些
    追踪发生了什么问题的机制。

[,mæl'fʌŋkʃən] n. 故障;失灵;疾病 vi. 发生故障;不起作用


  • 2 We all want to ... But the question is ...
    We all want to write an application with a well-designed logging feature. But the question is how to achieve an effective logging mechanism.
    我们都想用一个精心设计的日志记录功能编写一个应用程序。但问题是如何实现有效的记录机制。

  • 3 is capable of offering
    The normal System.out.println() logging methodology is not capable of offering such flexibility, because it does not provide a way to modify the behavior of the static logging code. Even if we accept that we always want to see what we produce, the other problem is that it is very difficult to segregate logging messages into different priority levels.
    正常的System.out.println() 日志记录方法论不能提供这种灵活性,因为它没有提供修改静态日志记录代码行为的方法。即便我们能接受 总看到产生的东西,那还有另一个难题就是无法将日志消息分级。

  • 4 paragraph-1

In essence, a robust logging framework means that the messages should be categorized in terms of their severity. (实质上,一个健壮的日志框架意味着消息应据其严重程度分类)
Also, we should be able to switch over to any severity level to see messages with only that level of severity. (另外,我们应能切换到任何严重级别来查看某个严重级别的消息)
But this sort of flexibility should not mean changes to the source code. (但是这种灵活性不应是由改源码带来的)
We need to achieve this flexibility via configuration parameters. Thus, a good logging system needs to be highly configurable. (我们需要通过配置参数来实现这种灵活性。 因此,一个好的日志系统需要高度可配置)


  • 5 paragraph-2

It is also very important that we be able to redirect logging information to a chosen destination, such as a database, file, etc., so that we can reuse that information. (将日志信息重定向到选定的目的地-例如数据库/文件等-也是非常重要的,以便我们可以重用这些信息。)
Console-based logging activity is limited; it is volatile, as the logging information is not stored anywhere for future reference. (基于控制台的日志活动是有限的; 它易变,因为日志信息没有存储在任何地方供将来参考)
A robust logging framework should offer flexibility in terms of the logging destination and message formatting. (强大的日志记录框架应该提供日志记录目标和消息格式方面的灵活性)


  • 6 paragraph-3

While it is true that a good logging API will provide a flexible, robust, and feature-rich logging environment, it also demands appropriate and efficient use of all these logging features. (确实,一个好的日志API将提供一个灵活,强大且功能丰富的日志环境,同时也要求适当而有效地使用所有这些日志功能。)
In this book, we will examine basic logging techniques with Apache log4j. Chapter 10 will focus on the best practices involved in using Apache log4j (在本书中,我们将使用Apache log4j来检查基本的日志记录技术。 第10章将重点介绍使用Apache log4j的最佳实践)


  • 7 paragraph-4

From the architectural point of view, software application modules and logging components reside in two separate layers. (从架构的角度来看,软件应用程序模块和日志记录组件分别位于两个独立的层中。)
The application makes a call to the logging components in the logging layer and delegates the logging responsibility to those components. (应用程序调用日志记录层中的日志记录组件,并将日志记录责任委托给这些组件。)
The logging components receive the logging request and publish the logging information at preferred destinations. (日志记录组件接收日志记录请求并在首选目标位置发布日志记录信息。)
Figure 1-1 represents the collaboration of a software module and its logging components. (图1-1表示软件模块及其日志记录组件的协作。)

image.png

相关文章

网友评论

      本文标题:Pro_Apache_Log4j - 1. How Loggin

      本文链接:https://www.haomeiwen.com/subject/sidiwxtx.html