Google guice has a built-in logger binding. But what if I want to use a commons-logging or log4j logger?
Can I get guice to inject a Log created by
LogFactory.getLog(CLASS.class)
But having the same behavior as in built-in binding:
The binding automatically sets the logger’s name to the name of the class into which the Logger is being injected..
Does it even makes sense? Or shout I simply use the built-in java Logger? Or just use commons-logging without injections?
The CustomInjections page on the Guice wiki describes exactly how to inject a logger named by the class it’s being injected into.