You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Pras P." <po...@gmail.com> on 2008/11/01 19:41:09 UTC

How to configure JMSAppender in JBoss?

Hello All,

I'm trying to configure JMSAppender in JBoss 4.2.3 using the built in JBoss MQ.
The JBoss MQ is not up when log4j is configured causing it to error out.
Here's what I've tried.

I modified the root jboss-log4j.xml (at server/default/conf) to enable
the appender.

      <appender name="TESTLOGGINGJMS" class="org.apache.log4j.net.JMSAppender">
        <param name="Threshold" value="ERROR"/>
        <param name="ProviderURL" value="localhost" />
        <param name="InitialContextFactoryName"
value="org.jnp.interfaces.NamingContextFactory" />
        <param name="URLPkgPrefixes" value="org.jboss.naming
rg.jnp.interfaces" />
        <param name="TopicConnectionFactoryBindingName"
value="TopicConnectionFactory"/>
        <param name="TopicBindingName" value="topic/loggingTopic"/>
      </appender>


I add my own logger to the same file as
Code:

        <logger name="com.prpo" additivity="false">
       <appender-ref ref="TESTLOGGINGJMS" />
      </logger>


When I start the jboss server, looks like the server is waiting for
the topic to be created.
And throws an exception saying

Code:

    14:26:34,627 INFO  [Log4jService$URLWatchTimerTask] Configuring
from URL: resource:jboss-log4j.
xml
   log4j:ERROR Error while activating options for appender named
[TESTLOGGINGJMS].
   javax.naming.CommunicationException: Could not obtain connection
to any of these urls: localhost
 and discovery failed with error: javax.naming.CommunicationException:
Receive timed out [Root excep
tion is java.net.SocketTimeoutException: Receive timed out] [Root
exception is javax.naming.Communic
ationException: Failed to connect to server localhost:1099 [Root
exception is javax.naming.ServiceUn
availableException: Failed to connect to server localhost:1099 [Root
exception is java.net.ConnectEx
ception: Connection refused]]]



This is because the JMS topic is not created yet. I create the topic
via a -service.xml file using MBeans.

How can I delay initializing the log4j appender until the topic is created?

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: How to configure JMSAppender in JBoss?

Posted by "Chitnis, Pooja" <Po...@BMC.com>.
Hi,

I think you will have to mention the topic name in the jndi.properties
file.
# topic.[jndiName] = [physicalName]
Example
	topic.testTopic = testTopic



Thanks & Regards,
Pooja Chitnis
-----Original Message-----
From: Pras P. [mailto:ponnala@gmail.com] 
Sent: Sunday, November 02, 2008 12:11 AM
To: log4j-user@logging.apache.org
Subject: How to configure JMSAppender in JBoss?

Hello All,

I'm trying to configure JMSAppender in JBoss 4.2.3 using the built in
JBoss MQ.
The JBoss MQ is not up when log4j is configured causing it to error out.
Here's what I've tried.

I modified the root jboss-log4j.xml (at server/default/conf) to enable
the appender.

      <appender name="TESTLOGGINGJMS"
class="org.apache.log4j.net.JMSAppender">
        <param name="Threshold" value="ERROR"/>
        <param name="ProviderURL" value="localhost" />
        <param name="InitialContextFactoryName"
value="org.jnp.interfaces.NamingContextFactory" />
        <param name="URLPkgPrefixes" value="org.jboss.naming
rg.jnp.interfaces" />
        <param name="TopicConnectionFactoryBindingName"
value="TopicConnectionFactory"/>
        <param name="TopicBindingName" value="topic/loggingTopic"/>
      </appender>


I add my own logger to the same file as
Code:

        <logger name="com.prpo" additivity="false">
       <appender-ref ref="TESTLOGGINGJMS" />
      </logger>


When I start the jboss server, looks like the server is waiting for
the topic to be created.
And throws an exception saying

Code:

    14:26:34,627 INFO  [Log4jService$URLWatchTimerTask] Configuring
from URL: resource:jboss-log4j.
xml
   log4j:ERROR Error while activating options for appender named
[TESTLOGGINGJMS].
   javax.naming.CommunicationException: Could not obtain connection
to any of these urls: localhost
 and discovery failed with error: javax.naming.CommunicationException:
Receive timed out [Root excep
tion is java.net.SocketTimeoutException: Receive timed out] [Root
exception is javax.naming.Communic
ationException: Failed to connect to server localhost:1099 [Root
exception is javax.naming.ServiceUn
availableException: Failed to connect to server localhost:1099 [Root
exception is java.net.ConnectEx
ception: Connection refused]]]



This is because the JMS topic is not created yet. I create the topic
via a -service.xml file using MBeans.

How can I delay initializing the log4j appender until the topic is
created?

thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org