Hi

I've followed instructions from

http://glauche.de/2009/08/24/logging-with-slf4j-and-guice/

To inject loggers via @InjectLogger tags, but this loggers are only available after the constructor has been executed.

class A {

  @InjectLogger private Logger logger;
  private final SomeClass someClass;

  @Inject
  A(SomeClas someClass) implements IA {
    logger.debug("Initializing A");
    this.someClass = someClass;
  }

  // ...
}

Fails with a:

| com.google.inject.CreationException: Guice creation errors:
|
| 1) Error injecting constructor, java.lang.NullPointerException
| ...

How can I have a logger injected and usable in the constructor?

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.

Reply via email to