8 Replies Latest reply on Dec 16, 2011 1:00 PM by Dan D

    JMS appender in JBoss AS 7

    Dan D Newbie

      I am trying to upgrade an application from JBoss 4.x to JBoss 7.

       

      In JBoss 4, a JMS appender was defined in jboss/server/<instance>/conf/log4j.xml

       

      {code:xml}

      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

        ...

        <appender name="JMS" class="org.apache.log4j.net.JMSAppender">

          <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>

          <param name="Threshold" value="DEBUG"/>

          <param name="InitialContextFactoryName" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>

          <param name="ProviderURL" value="tcp://localhost:61616"/>

          <param name="TopicBindingName" value="topics/logTopic"/>

          <param name="TopicConnectionFactoryBindingName" value="java:/ConnectionFactory"/>

        </appender>

        ...

        <root>

          ...

          <appender-ref ref="JMS"/>

        </root>

      </log4j:configuration>

      {code}

       

      I found some posts where people tried to do this in Jboss AS 6 by changing it to something like this:

       

       

      {code:xml}

      <log4j-appender name="JMS" class="org.apache.log4j.net.JMSAppender">

        <error-manager>

          <only-once/>

        </error-manager>

       

        <level name="DEBUG" />

       

        <properties>

          <property name="topicConnectionFactoryBindingName">ConnectionFactory</property>

          <property name="topicBindingName">topics/logTopic</property>

        </properties>

      </log4j-appender>

      {code}

       

      However based on what I've read in the linked article below, it sounds like other than the provided handlers (console, file, async), any others have to be re-written as a custom handler that implements java.util.logging.Handler. Looking at org.apache.log4j.net.JMSAppender, it doesn't seem like it implements this so it wouldn't be able to just plugin nicely.

       

      http://community.jboss.org/wiki/CustomLogHandlersOn701

       

      Can the apache JMSAppender still be used as a handler in JBoss AS 7 or does it need to be re-written?