logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Elsinghorst <elsingho...@conterra.de>
Subject Using my own Appender
Date Tue, 28 Mar 2006 07:28:36 GMT
Hi,

I wrote  a appender myself and now have Problems to integrate it into my 
project. Im using Eclipse (just in case it makes any difference).
I have the appender in a package called 
de.somecompany.someproject.MyAppender and a test class in the default 
package.
My log4j.properties file looks like this:

log4j.rootLogger = DEBUG, EOA

    #EOA
    log4j.appender.EOA = de.somecompany.someproject.MyAppender
    log4j.appender.EOA.filename=D://log.bin

When I try to run my testclass, I get the following errors:

    log4j:ERROR Could not instantiate class 
[de.somecompany.someproject.MyAppender].
    java.lang.ClassNotFoundException: de.somecompany.someproject.MyAppender
        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:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at org.apache.log4j.helpers.Loader.loadClass(Loader.java:178)
        at 
org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:317)
        at 
org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:120)
        at 
org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:629)
        at 
org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
        at 
org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
        at 
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
        at 
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:441)
        at 
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:468)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:122)
        at org.apache.log4j.Logger.getLogger(Logger.java:117)
        at LogTest.<init>(LogTest.java:10)
        at LogTest.main(LogTest.java:143)
    log4j:ERROR Could not instantiate appender named "EOA".
    log4j:WARN No appenders could be found for logger (LogTest).
    log4j:WARN Please initialize the log4j system properly.


When i manually add the appender to the Logger like this:
    private   Logger LOGGER2  = Logger.getLogger("nochein Logger");
    MyAppender eoa1 = new MyAppender();

the there is no problem. So where is my mistake? I hope someone of you 
can help me!

regards, Johannes Elsinghorst




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


Mime
View raw message