Hi, I'm pretty sure Guice doesn't allow you to inject automatically into static fields. The reason is, that statics are hard to test and will give you all sorts of headaches. Guice was probably not built with the injection of loggers in mind.
Or as Dhnaji said: "What's wrong with private static final Logger log = LoggerFactory.getLogger(MyClass.class);" If this is something you find to be to much to type, add it as a code template in your IDE or simply add it to the "New Class" template. If you insist on using Guice for providing loggers, it will make your unit testing much more complicated and difficult. If unit tests are run, without having Guice present, you either have to mock the logger or provide it to every class that uses one. Simply having the LoggerFactory lookup solves all of your problems at very low cost. regards, Guðmundur Bjarni On Sep 5, 10:53 am, onlytoine <[EMAIL PROTECTED]> wrote: > Hello, > > I create a new subject to ask about this point again. My need is to > inject a logger in all objects I create using Guice. > > I know it exists a built-in configuration to inject automatically a > Logger from java.util.... But I don't use it. > > So, how can I do ? > > Cheers, > Anthony --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
