Extending log4j Logger and using JMSAppender
stoffe Aug 21, 2002 8:48 AMHi!
I have seen a previous discussion about how to use the JMSAppender since the jbossmq is not started yet.
The solution was to write an own MBean that ads the JMSAppender later on in the startup phase.
But it would be much nicer if there is a way to do this just by extending the log4j config file.
Isn't there a way to specify a log4j config file in a sar,war and jar in the META-INF directory when you deploy a new module?
The same goes for to write an own Logger. When the JBoss starts i get a ClassNotFound exception.
It seams that the my jarfile in the lib directory is not appended to the classpath. I have seen that there has been some changes to this field during the betatesting of JBoss 3.0.0
I'm running the release version of 3.0.0
Any guesses?
Regards Kristoffer!
18:22:15,313 INFO [URLDeploymentScanner] Created
18:22:15,313 INFO [Log4jService] Starting
18:22:15,353 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
18:22:15,353 INFO [AbstractDeploymentScanner$ScannerThread] Running
log4j:ERROR Could not instantiate class [com.hotsip.charging.ChargingLoggerFactory].
java.lang.InstantiationException: com.hotsip.charging.ChargingLoggerFactory
at java.lang.Class.newInstance0(Class.java:281)
at java.lang.Class.newInstance(Class.java:249)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:315)
at org.apache.log4j.xml.DOMConfigurator.parseCategoryFactory(DOMConfigurator.java:353)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:776)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:673)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
...
And
log4j:ERROR Error while activating options for appender named [JMS].
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)