Hi, i'm evaluating Guice for use in one of my projects.
Looking at the code, i see that Guice uses JUL for logging, but i'm using
SLF4J so i want to have Guice logging to SLF4J.
With jul-to-slf4j library seems that this is possible, the configuration is
this:
public class AppGuiceServletContextListener extends
GuiceServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
LogManager.getLogManager().addLogger(Logger.getLogger("com.google.inject"));
// This ensure that com.google.inject logger exists
LogManager.getLogManager().getLogger("com.google.inject").addHandler(new
SLF4JBridgeHandler()); // Bind SLF4J bridge to "com.google.inject" logger
super.contextInitialized(servletContextEvent);
}
@Override
protected Injector getInjector() {
return Guice.createInjector(...);
}
}
The questions are:
Is this configuration correct?
Is there a better way to do this?
Why not including this in Guice documentation?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.