slf4j+logback

Post on 06-May-2015

6.331 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SLF4J + LogbackAlbert

junyuo@gmail.com

2

Simple Logging Facade for Java (SLF4J) Logback Pre-requistes Configuration example Reference

Agenda

3

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

http://www.slf4j.org/

Simple Logging Facade for Java (SLF4J)

4

5

Projects depending on SLF4J

6

No revolution, only evolution. log4j is no longer being actively developed The same basic plumbing only done better. Faster, smaller, higher gas mileage, and

generally more bang for the buck.

LOGBack

7

Logback offers a native implementation of the SLF4J API => Logback exposes its logging API through SLF4J.

If you are using logback, you are actually using SLF4J

SLF4J can delegate to log4j, logback, java.util.logging or JCL

SLF4J can bridge log4j, JCL and j.u.l.

logback-classic implements SLF4J

id Components

logback-core

logback-classic logback-access

8

logback.xml slf4j-api.jar logback-classic.jar logback-core.jar

Pre-requistes

9

Configuration example

10

Configuration example – cont.ConsoleAppender

RollingFileAppender

rollover daily or whenever the file size reaches 100MB

11

Configuration example – cont.

12

Configuration example – cont.ConsoleAppender

RollingFileAppender

13

SLF4J◦ http://www.slf4j.org/

Logback◦ http://logback.qos.ch/

Chapter 4: Appenders◦ http://logback.qos.ch/manual/appenders.html

Reference

top related