Before I begin my next question... MANY THANKS on the flurry of responses to
the PropertyConfigurator discussion.  I was already in the process of trying
to convince myself that the default initialization was the best way to solve
the problem (as Ceki also points out).  For now, that seems to be my best
bet.  I just need to ensure that the "log4j.properties" file is somewhere in
the classpath of the J2EE server.

Now, here's the new one (I think I must missing something obvious here, but
it continues to elude me).

Any thoughts on how I could get a ClassNotFound on the NullAppender, but
other Appenders are found just fine?

In my properties file, I set the Root Category to use the NullAppender.
Then, in other categories, I set various other appenders.  This worked very
well for me this morning.  This afternoon, however, I get the following
exception:

log4j:ERROR Could not instantiate class
[org.apache.log4j.performance.NullAppender].
java.lang.ClassNotFoundException: org.apache.log4j.performance.NullAppender
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:120)
        at
org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConver
ter.java:301)

        at
org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.ja
va:116)
        at
org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.jav
a:612)
        at
org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.jav
a:595)
        at
org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigur
ator.java:522
)
        at
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:
412)
        at
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:
436)
        at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.
java:455)
        at org.apache.log4j.Category.<clinit>(Category.java:146)
        at com.atsllc.util.log.Logger.<init>(Logger.java:98)
        at com.atsllc.util.log.Logger.getLogger(Logger.java:39)
        at com.atsllc.util.log.Logger$Test.<clinit>(Logger.java:154)
log4j:ERROR Could not instantiate appender named "LogOff".
[app1 12-Oct-2001 13:41:12.041 INFO ] Beginning Application
[app1 Charles 12-Oct-2001 13:41:12.071 INFO ] Running thread [5]
...  <rest of log removed>  ...

Here's my log4j.properties file:

log4j.rootCategory=INFO, LogOff
log4j.category.com.atsllc.util.log=INFO, Console

log4j.appender.LogOff=org.apache.log4j.performance.NullAppender
log4j.appender.LogOff.layout=org.apache.log4j.SimpleLayout

log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%x %d{dd-MMM-yyyy
HH:mm:ss.SSS} %-5p] %m%n

log4j.appender.LogFile=org.apache.log4j.RollingFileAppender
log4j.appender.LogFile.File=test.log
log4j.appender.LogFile.MaxFileSize=1000KB
log4j.appender.LogFile.MaxBackupIndex=10
log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
log4j.appender.LogFile.layout.ConversionPattern=[%x %d{dd-MMM-yyyy
HH:mm:ss.SSS} %-5p] %m%n


It is finding the Log4J ConsoleAppender and RollingFileAppender.  Any
thougts on why I might be getting a ClassNotFound on the NullAppender?

David W. Schultz
AT&S Transportation, LLC: (704) 529-6300 x 125

Attachment: aleabanr.gif
Description: GIF image

<<Leaves Bkgrd.jpg>>

Reply via email to