Log4j/slf4j/common-logging/logback日志

With spring have to use, you will hear a lot of logs associated libraries, log4j/ slf4j/ common-logging/ log4j-over-slf4j, not too get to know them before logging system is in what to say, today saw the article ), to understand a lot.

First log system basic concept can be divided into two parts, one is the interface, it is a realization.

  • Interface: the interface is called when the class how to call
  • Implementation: log output logic function to achieve full give

Wherein slf4jand common-loggingbelonging to the interface.
log4jAnd logbackbelongs to achieve.

Specifically, common-loggingthe interface and log4fcan be considered to generation, through common-loggingthe interface, use log4j.

And slf4jthe emergence of promising alternative common-logging, also logbacka promising alternative log4j.
slf4jCorresponding to common-loggingthe advantage of the interface, support for formatted log output parameters, not many +plus stitching so.
And logbackthe corresponding log4jadvantages should be on efficiency.

Others can see there are some, such as log4j-over-slf4jthis library is equivalent to log4jadapt to the slf4jinterface, belongs to the adaptation layer between the interface layer and implementation layer.

Guess you like

Origin www.cnblogs.com/mosakashaka/p/12609335.html