Introduction

The sli4j, achronimous of Simple Logger Injector for Java, is a small, light and fast logger Injector, built on top of Google-Guice, for the well known frameworks:

  • Java Utils Logging;
  • Apache commons-logging;
  • Apache log4j;
  • Simple Logging Facade for Java slf4j, with Logback support.

    The concept behind sli4j is that instead of creating Loggers by hand, users can let Guice creates and injects them automagically, for example instead writing:

    import java.util.logging.Logger;
    ...
    Logger logger = Logger.getLogger(this.getClass().getName());
    ...

    users can easily code:

    import java.util.logging.Logger;
    ...
    Logger logger;
    ...

    and nothing more! No setter methods are needed, no special annotations, just declare it and let sli4j doing the rest, final and already set Loggers will be skipped and sli4j won't try to override them at all.

Before Coding...

To set up your project, configure in your pom.xml the repository:

<repositories>
    ...
    <repository>
        <id>sli4j-repository</id>
        <name>sli4j Repository for Maven</name>
        <url>http://sli4j.googlecode.com/svn/repo</url>
        <layout>default</layout>
    </repository>
    ...
</repositories>

Acknowledgements

This work is dedicated to our city, L'Aquila, destroyed by a terrible earthquake the 6th April, 2009... That day more than 300 people were killed because buildings collapsed after a magnitudo 6.3 earthquake at 3:32 am.

We'll never forget that episode.