Logback is a native implementation of SLF4J and an advanced logging implementation. Here is its mapping with the concepts we talked about:
Concept | Name |
Logger | Logger (from SLF4J) |
Logger Factory | LoggerFactory (from SLF4J) |
Handler | Appender |
Filter | Filter |
Formatter | Encoder/Layout |
Level | Level |
Note that logback also has the concept of Encoder to link the messages to byte[].
The configuration relies, by default, on a logback.xml file in the classpath, looking like this:
<configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <root level="debug"> <appender-ref ref="STDOUT" /> </root> ...