SLF4J Logger Injection with Guice

I experimented with Google Guice Custom Injections because I wanted to inject a Logger to my guicified application. There is a great part in the Guice documentation about Custom Logger Injection, but in my case I wanted a SLF4J Logger with Logback as implementation. The example in the Guice Wiki is with Log4j Injection.

Here is how I wanted to inject loggers:

1
2
3
4
5
6
@Log
Logger log;
 
public void doSomething{
  log.info("Logmessage");
}

Weiterlesen