How do I get JMSAppender to work on JBoss EAP startup?

Solution Verified - Updated -

Issue

Currently we are trying to get log4j to send messages to a JMS Topic. For this we are using a JMSAppender with the following configuration

<appender name="PangaeaEmailJms" class="org.apache.log4j.net.JMSAppender">  
  <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>  
  <param name="TopicConnectionFactoryBindingName" value="java:JmsXA"/>  
  <param name="TopicBindingName" value="topic/EmailTopic"/>  
</appender>

This is added to jboss-log4j.xml.

When restarting JBoss, Log4j is complaining about not being able to use java:/JmsXA.

This is a part of the exception:

18:12:52,027 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
log4j:ERROR Could not find name [java:JmsXA].
log4j error: Error while activating options for appender named [PangaeaEmailJms].
javax.naming.NameNotFoundException: JmsXA not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:581)

This isn't strange since JMS didn't startup yet.

I tried playing with adding a dependency in the file jboss-service.xml in the mbean configuration org.jboss.logging.Log4jService. But somehow I am unable to find a dependency which will allow log4j to wait being initialized after JMS fully started.

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 4.x
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content