Fork me on GitHub

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.

    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( getClass().getName() );
    ...

    users can easily code:

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

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

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.