Saturday, June 17, 2006

Log4J Bug

I painfully found a bug within Log4J while working on a project. It appears that intermittantly, the following error will be thrown while using version 1.2.13:

NullPointerException at org.apache.log4j.NDC.get(NDC.java:209)

There is no work around. The best bet (and my choice of action) is to download and use the repaired version 1.3-alpha 8...even though it is still in test mode.

4 comments:

  1. Anonymous7:18 AM

    I'm getting this exact bug. Arg! I guess I will try the test release as you suggest

    ReplyDelete
  2. Anonymous7:56 PM

    Hi, got the same error...
    org.apache.log4j.NDC.get(NDC.java:209)

    googled it, found your post, and then i search for the alpha log4j, n i found this...

    log4j version 1.2.14
    The following bugs were fixed:
    40159: NullPointerException in org.apache.log4j.NDC.get.

    Good Luck!

    Ryan Yong.

    ReplyDelete
  3. Hi Guys,

    I am facing problems when i am implementing log4j in our web- project. Problem is, I wanna create log file in our application context.
    I followed all the steps which is require for implementing log4J but my log file is creating under server folder not in application context.

    i am using following things in log4j.properties file,
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=TestLogger.log

    I think we need some additional configuration for simulating this task. So plz guys help me. I am waiting for ur response.

    Regards,
    Dilip

    ReplyDelete
  4. dddd,

    Sorry you are having issues with Log4j. Actually, you will need to give the complete file path to where you wish the log to be located. For instance instead of:
    log4j.appender.R.File=TestLogger.log
    use
    log4j.appender.R.File=C:\\MYAPP\\TestLogger.log

    As far as I know, there is no way to automatically make the log write into your application context.

    Best to you!

    Josh

    ReplyDelete

Please leave a comment...