简介

作者: zmdstr | 来源:发表于2017-02-16 21:41 被阅读0次

    “线上出Bug了。。。”
    “快看看日志,哪里出问题了。。。”


    日志记录是软件开发不可缺少的部分,该文集将对日志做一些介绍。
    我想提到日志, log4j 你一定知道,也许你在想,我还知道 logback,也知道 slf4j。

    why logging

    Inserting log statements into your code is a low-tech method for debugging it. It may also be the only way because debuggers are not always available or applicable. This is often the case for distributed applications.

    On the other hand, some people argue that log statements pollute source code and decrease legibility. (We believe that the contrary is true). In the Java language where a preprocessor is not available, log statements increase the size of the code and reduce its speed, even when logging is turned off. Given that a reasonably sized application may contain thousands of log statements, speed is of particular importance.

    Logback Project

    Logback is intended as a successor to the popular log4j project, picking up where log4j leaves off.

    Simple Logging Facade for Java (SLF4J)

    The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.

    LOG4J LOGBack SLF4J

    Log4j是Apache的一个开源项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台、文件、GUI组件,甚至是套接口服务器、NT的事件记录器、UNIX Syslog守护进程等。

    Logback是由log4j创始人设计的又一个开源日志组件。logback当前分成三个模块:logback-core,logback- classic和logback-access。logback-core是其它两个模块的基础模块。logback-classic是log4j的一个 改良版本。此外logback-classic完整实现SLF4J API使你可以很方便地更换成其它日志系统如log4j或JDK14 Logging。logback-access访问模块与Servlet容器集成提供通过Http来访问日志的功能。

    SLF4J,即简单日志门面(Simple Logging Facade for Java),不是具体的日志解决方案,它只服务于各种各样的日志系统。按照官方的说法,SLF4J是一个用于日志系统的简单Facade,允许最终用户在部署其应用时使用其所希望的日志系统。

    相关文章

      网友评论

          本文标题:简介

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