Showing posts with label SLF4J. Show all posts
Showing posts with label SLF4J. Show all posts

Tuesday, October 11, 2011

How to use SLF4J with Log4j


Today I will show you how to use SLF4J with Log4j on a simple example.

Let's start with Log4j. First, download log4j library and add log4j-1.2.16.jar into classpath.

Create log4j.properties file, which will contain log4j configuration and put it into project. It may look like this:

log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%c{1}][%p]: %m%n