2 Replies Latest reply: Apr 26, 2007 5:14 AM by 807606 RSS

    Log4j, appender and InstantiationException

    807606
      Hi,

      I have written my own appender in an Eclipse project that uses log4j. When I try to use the appender I get the following exception:
      log4j:ERROR Could not instantiate class [test.appender.NewFileAppender].
      java.lang.InstantiationException: test.appender.NewFileAppender
           at java.lang.Class.newInstance0(Unknown Source)
           at java.lang.Class.newInstance(Unknown Source)
           at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:329)
           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.parseCatsAndRenderers(PropertyConfigurator.java:533)
           at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:417)
           at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
           at org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:682)
           at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
           at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:57)
           at org.apache.log4j.PropertyWatchdog.<init>(PropertyConfigurator.java:674)
           at org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:382)
           at se.micronic.argos.main.Main.initLogging(Main.java:305)
           at se.micronic.argos.main.Main.<init>(Main.java:272)
           at se.micronic.argos.main.Main.main(Main.java:1339)
      log4j:ERROR Could not instantiate appender named "argos".
      My property file looks like this:
      log4j.appender.argos=test.appender.NewFileAppender
      log4j.appender.argos.file=logs/MArgos.log
      The other appenders in the property file work fine.

      Any ideas?

      Thanks
      Markus