How to configure SLF4J with different logger implementations

About Zemian Deng

There are many good benefits in using slf4j library as your Java application logging API layer. Here I will show few examples on how to use and configure it with different loggers.

You can think of slf4j as an Java interface, and then you would need an implementation (ONLY ONE) at runtime to provide the actual logging details, such as writing to STDOUT or to a file etc. Each logging implementation (or called binding) would obviously have their own way of configuring the log output, but your application will remain agnostic and always use the same org.slf4j.Logger API. Let’s see how this works in practice.
 

Using slf4j with Simple logger

Create a Maven based project and this in your pom.xml.


Source : http://www.javacodegeeks.com/2013/08/how-to-configure-slf4j-with-different-logger-implementations.html

Back to Top