Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on


  1. 1. SLF4J + Logback<br />Albert<br /><br />
  2. 2. Simple Logging Facade for Java (SLF4J)<br />Logback<br />Pre-requistes<br />Configuration example<br />Reference<br />2<br />Agenda<br />
  3. 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.<br /><br />Simple Logging Facade for Java (SLF4J)<br />3<br />
  4. 4. 4<br />
  5. 5. Projects depending on SLF4J<br />5<br />
  6. 6. No revolution, only evolution.<br />log4j is no longer being actively developed<br />The same basic plumbing only done better. <br />Faster, smaller, higher gas mileage, and generally more bang for the buck.<br />6<br />LOGBack<br />
  7. 7. Logback offers a native implementation of the SLF4J API => Logback exposes its logging API through SLF4J.<br />If you are using logback, you are actually using SLF4J<br />SLF4J can delegate to log4j, logback, java.util.logging or JCL<br />SLF4J can bridge log4j, JCL and j.u.l.<br />7<br />logback-classic implements SLF4J<br />
  8. 8. logback.xml<br />slf4j-api.jar<br />logback-classic.jar<br />logback-core.jar<br />8<br />Pre-requistes<br />
  9. 9. 9<br />Configuration example<br />
  10. 10. 10<br />Configuration example – cont.<br />ConsoleAppender<br />RollingFileAppender<br /> rollover daily or whenever the <br />file size reaches 100MB<br />
  11. 11. 11<br />Configuration example – cont.<br />
  12. 12. 12<br />Configuration example – cont.<br />ConsoleAppender<br />RollingFileAppender<br />
  13. 13. SLF4J<br /><br />Logback<br /><br />Chapter 4: Appenders<br /><br />13<br />Reference<br />