I am not quite sure about your situation but I think the solution will be:
1. Make sure your custom appender class is declared public
2. Programmatically add the appender to a log4j Logger (called Category in older log4j) after log4j has been initialized.
> I have written a custom log4j Appender to store usage
> data in our database. I have been trying to get this
> to work under JBoss 2.4.6 to no avail. I always
> receive a NoClassDefFoundError.
> I tried adding this appender to relvant Categories in
> the log4j.properties file, but that breaks because
> the class is in my .ear, which is deployed well after
> JBoss starts up it's logging service. I tried
> putting my appender class in a .jar of it's own and
> adding it to the startup classpath in run.sh. No
> luck. I tried removing the appender from the
> log4j.properties file and adding it at runtime in my
> EJB, but still I get the NoClassDefFoundError--which
> doesn't make any sense to me at all.
> Can anyone help? Has anyone had any luck getting a
> custom appender to run under JBoss 2.4.6? If so,
> Charles W. Stanton
Put the appender class in a standalone jar. Put that jar in jboss\lib\ext. In jboss\conf\???\jboss.conf find the org.jboss.logging.Log4jService MLET (should be the first one). Append the name of your appender jar to the ARCHIVE attribute.
Your jar = MY_APPENDER.jar
<!-- The log4j based logging service based on the conf log4j.properties file -->
This should do the trick.