SLF4J, Common Logging, console output

Posted by Mauricio Scheffer on Stack Overflow See other posts from Stack Overflow or by Mauricio Scheffer
Published on 2011-02-06T05:42:31Z Indexed on 2011/02/06 7:26 UTC
Read the original article Hit count: 414

I have this 3rd party library that has:

  • slf4j-api-1.5.5.jar
  • slf4j-jdk14-1.5.5.jar
  • jcl-over-slf4j-1.5.5.jar

I want to write some tests against this library and see its log output, and I don't want to add any more logging libraries (no log4j or anything else).

I understand that SLF4J and Common Logging are both logging abstractions so I probably need to write my own simple concrete logger (or maybe not, since jcl-over-slf4j includes org.apache.commons.logging.impl.SimpleLog?). If so, what interfaces should I implement, and more importantly, how do I set up SL4J/Common Logging to use my logger in my test? I read in the SLF4J docs that I have to modify the StaticLoggerBinder class... does that really mean that I actually have to download SLF4J sources, modify the class and recompile it?

© Stack Overflow or respective owner

Related posts about java

Related posts about apache-commons