0

I am relatively new to JBOSS. I have to use a custom appender of which I have a jar file available.

For eg.

<appender name="MYLOGGER" class="org.log4j.appender.MyLogAppender">
  <param name="File" value="/logs/abc.log"/>
  <param name="Threshold" value="DEBUG"/> 
  ...more parameters...
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%-5p %-23d{} [%t] %x: %c{1} - %m%n"/>
  </layout>
</appender>

But doing so I get the error

log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.ClassNotFoundException: org.log4j.appender.MyLogAppender

Which file other than jboss-log4j.xml must be configured ?

Where must the jar file be placed in the jboss hierarchy and how must the jboss-log4j.xml be configured to use the appender ?

Thanks.

richa.a91
  • 11
  • 1
  • 8

1 Answers1

1

You don't say which version of JBoss that you're using, but for JBoss 5.1.0, Log4J lives in $JBOSS_HOME/common/lib, so I'd suggest putting your jar file there.

Raj
  • 125
  • 1
  • 11
  • Yes, I am using JBoss 5.1.0. I've already put the jar file there. But dont know why it can not locate the class. Does the jar file or its path need to be mentioned in some other configuration file as well ? – richa.a91 Jul 12 '13 at 04:00
  • In your code snap above, you have the line: `` I'm not sure you should be using the package org.log4j.appender. Try changing the package of your class and making sure that the class in the XML matches – Raj Jul 17 '13 at 08:18