Hello, all:

I have a problem with default configuration and the AppServer classes.

I'm using an xml configuration file, log4j.xml, with the following category
entry (note the class attribute):

     <category name="com.ntrs.els" class="com.ntrs.els.log4j.AppServerCategory">
        <priority value="debug" />
        <appender-ref ref="ELSOUT" />
     </category>

If I explicitly call

      DOMConfigurator.configure("f:/work/log4j/NewELS/log4j.xml");

in my program, everything is fine.  If I remove the explicit configuration call
and add the system property

      -Dlog4j.configuration=file:/work/log4j/NewELS/log4j.xml

then I get the following error:

log4j: Disable override="null".
log4j: Disable ="null".
log4j: Desired category sub-class: [com.ntrs.els.log4j.AppServerCategory]
log4j:ERROR Could not retrieve category [com.ntrs.els]. Reported error follows.
java.lang.reflect.InvocationTargetException: java.lang.NullPointerException:
        at org.apache.log4j.Hierarchy.getInstance(Hierarchy.java:298)
        at org.apache.log4j.Category.getInstance(Category.java:589)
        at
com.ntrs.els.log4j.AppServerCategory.getInstance(AppServerCategory.java:59)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:299)
        at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:691)
        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:593)
        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:545)
        at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:455)
        at org.apache.log4j.Category.<clinit>(Category.java:146)
        at com.ntrs.els.test.ELSTestProg.<clinit>(ELSTestProg.java:22)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:124)
        at com.borland.jbuilder.util.BootStrap.invokeMain(Unknown Source)
        at com.borland.jbuilder.util.BootStrap.main(Unknown Source)
log4j: Priority value for root is  [debug].
log4j: root priority set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
...

If I remove the class attribute from the xml category definition, then the
static initialization works fine.
It appears there is some problem instantiating my AppServerCategory class, but
I'm not sure what is going on.

I'm using version 1.1.3 of Log4j.

Can anyone explain this behavior? What am I missing for static initialization?

Thanks,
Ernie Parker



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to