You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@onami.apache.org by xybrek <xy...@gmail.com> on 2013/05/29 03:06:46 UTC

NullPointerException on @InjectLogger

I added this to my projects POM:

<dependency>
<groupId>org.apache.onami.logging</groupId>
<artifactId>org.apache.onami.logging.log4j2</artifactId>
<version>3.4.0-incubating</version>
</dependency>


And do @InjectLogger

    @InjectLogger
    Logger logger;

    logger.info("Created"); // NPE here.

What could be the problem?

Re: NullPointerException on @InjectLogger

Posted by Simone Tripodi <si...@apache.org>.
Good catch, Nino!

I think as well xybrek missed the Module installation, see [1], kind of

+----------------+
Injector injector = Guice.createInjector( new Log4j2LoggingModule(
Matchers.any() ),
    ...
+----------------+

Please let us know, HTH!!!
All the best,
-Simo

[1] http://onami.apache.org/logging/log4j2.html

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Wed, May 29, 2013 at 8:02 AM, nino martinez wael
<ni...@gmail.com> wrote:
> My bet would be that you need til install the logger module?
>
>
> 2013/5/29 xybrek <xy...@gmail.com>
>>
>> I added this to my projects POM:
>>
>> <dependency>
>> <groupId>org.apache.onami.logging</groupId>
>> <artifactId>org.apache.onami.logging.log4j2</artifactId>
>> <version>3.4.0-incubating</version>
>> </dependency>
>>
>>
>> And do @InjectLogger
>>
>>     @InjectLogger
>>     Logger logger;
>>
>>     logger.info("Created"); // NPE here.
>>
>> What could be the problem?
>
>
>
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez

Re: NullPointerException on @InjectLogger

Posted by nino martinez wael <ni...@gmail.com>.
My bet would be that you need til install the logger module?

2013/5/29 xybrek <xy...@gmail.com>

> I added this to my projects POM:
>
> <dependency>
> <groupId>org.apache.onami.logging</groupId>
>  <artifactId>org.apache.onami.logging.log4j2</artifactId>
> <version>3.4.0-incubating</version>
>  </dependency>
>
>
> And do @InjectLogger
>
>     @InjectLogger
>     Logger logger;
>
>     logger.info("Created"); // NPE here.
>
> What could be the problem?
>



-- 
Best regards / Med venlig hilsen
Nino Martinez