You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Peter DePasquale <pe...@gmail.com> on 2012/10/16 06:21:04 UTC

Null Pointer Exception - Help request - New to log4j2

I'm trying to use Log4j2 in a research project. I did manage to get
the simplest HelloWorld program using log4j2, but I can't seem to get
past an annoying NPE in one class in the larger project.

I've used pastebin as follows. I welcome thoughts and help on this
issue. I really need a nice logging solution to track down a few nasty
bugs that are plaguing me, and I'm finally going whole hog here and
jumping into log4j2 (or trying to) for the whole project...

Config file: http://pastebin.com/8cFbFejE
Source code: http://pastebin.com/aTmZfZMN
Runtime output: http://pastebin.com/H9R94PFg

I've cut all methods from the source file below the first (start)
where my initial integration attempt is located.

The program compiles fine. For my purposes, I'm building the app as a
jar file, and have expanded all of the listed jar files from log4j2
and included that structure (and Log4J-V2.0.xsd as well...).

Thanks for any help/insight into the NPE problem.

-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Null Pointer Exception - Help request - New to log4j2

Posted by "Peter J. DePasquale" <pe...@gmail.com>.
Thanks 

Ralph Goers <rg...@apache.org> wrote:

>I've written the code that should fix it but I haven't checked it in
>yet as I need to do something to test it.  I'll let you know when I
>commit it.
>
>Ralph
>
>On Oct 16, 2012, at 5:13 AM, Peter DePasquale
><pe...@gmail.com> wrote:
>
>> Thanks for the reply.  The project is pretty big and would take a
>> while to explain so that you would be able to run it. It parses
>source
>> code and produces a report on the commenting. I had cut the bottom of
>> that single class where I added log4j2 code, as it was pretty big. I
>> had only attempted to use log4j2 in just that one shown method, as a
>> starting point for myself.
>> 
>> I'm not sure what I would do to deal with the test/real
>implementation
>> issue you mention below. I've done my best to follow the
>documentation
>> on the web site. I did see some obvious typos there (a few imports
>are
>> missing etc. in examples), so I fell back to a simple hello world
>that
>> I can get running with the same type of logging statements (trace
>> statements).
>> 
>> I may play with it a bit more today, but be forced to use another
>> system if I can't determine where the problems lie.
>> 
>> On Tue, Oct 16, 2012 at 12:54 AM, Ralph Goers
>> <ra...@dslextreme.com> wrote:
>>> Providing a zip of the project so I could test it would be better. I
>think the source code paste has something wrong - it doesn't look like
>the whole class is there.
>>> 
>>> That said, my guess is the NPE is similar to one reported earlier.
>They were running under Eclipse and it was finding the binding for both
>the test implementation in the API and the real implementation in core.
> That is on my list of things to fix.
>>> 
>>> If that doesn't seem like it fits the problem you are encountering
>then please provide me with a sample project that I can build and run
>that exhibits this behavior.
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 15, 2012, at 9:21 PM, Peter DePasquale wrote:
>>> 
>>>> I'm trying to use Log4j2 in a research project. I did manage to get
>>>> the simplest HelloWorld program using log4j2, but I can't seem to
>get
>>>> past an annoying NPE in one class in the larger project.
>>>> 
>>>> I've used pastebin as follows. I welcome thoughts and help on this
>>>> issue. I really need a nice logging solution to track down a few
>nasty
>>>> bugs that are plaguing me, and I'm finally going whole hog here and
>>>> jumping into log4j2 (or trying to) for the whole project...
>>>> 
>>>> Config file: http://pastebin.com/8cFbFejE
>>>> Source code: http://pastebin.com/aTmZfZMN
>>>> Runtime output: http://pastebin.com/H9R94PFg
>>>> 
>>>> I've cut all methods from the source file below the first (start)
>>>> where my initial integration attempt is located.
>>>> 
>>>> The program compiles fine. For my purposes, I'm building the app as
>a
>>>> jar file, and have expanded all of the listed jar files from log4j2
>>>> and included that structure (and Log4J-V2.0.xsd as well...).
>>>> 
>>>> Thanks for any help/insight into the NPE problem.
>>>> 
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>> 
>>>>
>---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>> 
>>> 
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>> 
>> 
>> -- 
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-dev-help@logging.apache.org

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Re: Null Pointer Exception - Help request - New to log4j2

Posted by Ralph Goers <rg...@apache.org>.
I've written the code that should fix it but I haven't checked it in yet as I need to do something to test it.  I'll let you know when I commit it.

Ralph

On Oct 16, 2012, at 5:13 AM, Peter DePasquale <pe...@gmail.com> wrote:

> Thanks for the reply.  The project is pretty big and would take a
> while to explain so that you would be able to run it. It parses source
> code and produces a report on the commenting. I had cut the bottom of
> that single class where I added log4j2 code, as it was pretty big. I
> had only attempted to use log4j2 in just that one shown method, as a
> starting point for myself.
> 
> I'm not sure what I would do to deal with the test/real implementation
> issue you mention below. I've done my best to follow the documentation
> on the web site. I did see some obvious typos there (a few imports are
> missing etc. in examples), so I fell back to a simple hello world that
> I can get running with the same type of logging statements (trace
> statements).
> 
> I may play with it a bit more today, but be forced to use another
> system if I can't determine where the problems lie.
> 
> On Tue, Oct 16, 2012 at 12:54 AM, Ralph Goers
> <ra...@dslextreme.com> wrote:
>> Providing a zip of the project so I could test it would be better. I think the source code paste has something wrong - it doesn't look like the whole class is there.
>> 
>> That said, my guess is the NPE is similar to one reported earlier. They were running under Eclipse and it was finding the binding for both the test implementation in the API and the real implementation in core.  That is on my list of things to fix.
>> 
>> If that doesn't seem like it fits the problem you are encountering then please provide me with a sample project that I can build and run that exhibits this behavior.
>> 
>> Ralph
>> 
>> 
>> On Oct 15, 2012, at 9:21 PM, Peter DePasquale wrote:
>> 
>>> I'm trying to use Log4j2 in a research project. I did manage to get
>>> the simplest HelloWorld program using log4j2, but I can't seem to get
>>> past an annoying NPE in one class in the larger project.
>>> 
>>> I've used pastebin as follows. I welcome thoughts and help on this
>>> issue. I really need a nice logging solution to track down a few nasty
>>> bugs that are plaguing me, and I'm finally going whole hog here and
>>> jumping into log4j2 (or trying to) for the whole project...
>>> 
>>> Config file: http://pastebin.com/8cFbFejE
>>> Source code: http://pastebin.com/aTmZfZMN
>>> Runtime output: http://pastebin.com/H9R94PFg
>>> 
>>> I've cut all methods from the source file below the first (start)
>>> where my initial integration attempt is located.
>>> 
>>> The program compiles fine. For my purposes, I'm building the app as a
>>> jar file, and have expanded all of the listed jar files from log4j2
>>> and included that structure (and Log4J-V2.0.xsd as well...).
>>> 
>>> Thanks for any help/insight into the NPE problem.
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Null Pointer Exception - Help request - New to log4j2

Posted by Peter DePasquale <pe...@gmail.com>.
Thanks for the reply.  The project is pretty big and would take a
while to explain so that you would be able to run it. It parses source
code and produces a report on the commenting. I had cut the bottom of
that single class where I added log4j2 code, as it was pretty big. I
had only attempted to use log4j2 in just that one shown method, as a
starting point for myself.

I'm not sure what I would do to deal with the test/real implementation
issue you mention below. I've done my best to follow the documentation
on the web site. I did see some obvious typos there (a few imports are
missing etc. in examples), so I fell back to a simple hello world that
I can get running with the same type of logging statements (trace
statements).

I may play with it a bit more today, but be forced to use another
system if I can't determine where the problems lie.

On Tue, Oct 16, 2012 at 12:54 AM, Ralph Goers
<ra...@dslextreme.com> wrote:
> Providing a zip of the project so I could test it would be better. I think the source code paste has something wrong - it doesn't look like the whole class is there.
>
> That said, my guess is the NPE is similar to one reported earlier. They were running under Eclipse and it was finding the binding for both the test implementation in the API and the real implementation in core.  That is on my list of things to fix.
>
> If that doesn't seem like it fits the problem you are encountering then please provide me with a sample project that I can build and run that exhibits this behavior.
>
> Ralph
>
>
> On Oct 15, 2012, at 9:21 PM, Peter DePasquale wrote:
>
>> I'm trying to use Log4j2 in a research project. I did manage to get
>> the simplest HelloWorld program using log4j2, but I can't seem to get
>> past an annoying NPE in one class in the larger project.
>>
>> I've used pastebin as follows. I welcome thoughts and help on this
>> issue. I really need a nice logging solution to track down a few nasty
>> bugs that are plaguing me, and I'm finally going whole hog here and
>> jumping into log4j2 (or trying to) for the whole project...
>>
>> Config file: http://pastebin.com/8cFbFejE
>> Source code: http://pastebin.com/aTmZfZMN
>> Runtime output: http://pastebin.com/H9R94PFg
>>
>> I've cut all methods from the source file below the first (start)
>> where my initial integration attempt is located.
>>
>> The program compiles fine. For my purposes, I'm building the app as a
>> jar file, and have expanded all of the listed jar files from log4j2
>> and included that structure (and Log4J-V2.0.xsd as well...).
>>
>> Thanks for any help/insight into the NPE problem.
>>
>> --
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>



-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Null Pointer Exception - Help request - New to log4j2

Posted by Ralph Goers <ra...@dslextreme.com>.
Providing a zip of the project so I could test it would be better. I think the source code paste has something wrong - it doesn't look like the whole class is there.

That said, my guess is the NPE is similar to one reported earlier. They were running under Eclipse and it was finding the binding for both the test implementation in the API and the real implementation in core.  That is on my list of things to fix.

If that doesn't seem like it fits the problem you are encountering then please provide me with a sample project that I can build and run that exhibits this behavior.

Ralph


On Oct 15, 2012, at 9:21 PM, Peter DePasquale wrote:

> I'm trying to use Log4j2 in a research project. I did manage to get
> the simplest HelloWorld program using log4j2, but I can't seem to get
> past an annoying NPE in one class in the larger project.
> 
> I've used pastebin as follows. I welcome thoughts and help on this
> issue. I really need a nice logging solution to track down a few nasty
> bugs that are plaguing me, and I'm finally going whole hog here and
> jumping into log4j2 (or trying to) for the whole project...
> 
> Config file: http://pastebin.com/8cFbFejE
> Source code: http://pastebin.com/aTmZfZMN
> Runtime output: http://pastebin.com/H9R94PFg
> 
> I've cut all methods from the source file below the first (start)
> where my initial integration attempt is located.
> 
> The program compiles fine. For my purposes, I'm building the app as a
> jar file, and have expanded all of the listed jar files from log4j2
> and included that structure (and Log4J-V2.0.xsd as well...).
> 
> Thanks for any help/insight into the NPE problem.
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org