You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by selezovikj <se...@gmail.com> on 2008/10/16 12:03:42 UTC

Log4j JMS appender - failover

I want to be logging to a primary host, and in case it fails to a secondary
host. 
However log4j does not support the failover keyword. 

log4j.appender.jms.ProviderURL=failover:(tcp://localhost:61617,
tcp://localhost:61616)?randomize=false

It complains in the following way: 

log4j:ERROR Error while activating options for appender named [jms].
javax.naming.NamingException: Invalid broker URL
	at
org.apache.activemq.jndi.ActiveMQInitialContextFactory.getInitialContext(ActiveMQInitialContextFactory.java:67)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
...


Is there any other way to specify in the JMS appender the primary and
secondary hosts ? 




-- 
View this message in context: http://www.nabble.com/Log4j-JMS-appender---failover-tp20010627s22882p20010627.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Log4j JMS appender - failover

Posted by selezovikj <se...@gmail.com>.
Should I try with the latest SNAPSHOT or something ? 
Can someone please reply with any suggestions. 



selezovikj wrote:
> 
> java.naming.provider.url =
> failover:(tcp://localhost:61617,tcp://localhost:61616)?initialReconnectDelay=20&maxReconnectDelay=1000&randomize=false
> 
> I don't see any reconnection tries. 
> All the log files say is: 
> Waking up reconnect task
> org.apache.activemq.transport.failover.FailoverTransport DEBUG  -
> Attempting connect to: tcp://localhost:61617
> 
> 
> 
> James.Strachan wrote:
>> 
>> 2008/10/16 selezovikj <se...@gmail.com>:
>>>
>>> You are right.
>>> However, what I get is:
>>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Waking
>>> up
>>> reconnect task
>>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  -
>>> Attempting
>>> connect to: tcp://localhost:61617
>> 
>> You sure you've got the right port number?
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://fusesource.com/
>> 
>> 
> 
> 



-- 
View this message in context: http://www.nabble.com/Log4j-JMS-appender---failover-tp20010627s22882p20015691.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Log4j JMS appender - failover

Posted by selezovikj <se...@gmail.com>.
java.naming.provider.url =
failover:(tcp://localhost:61617,tcp://localhost:61616)?initialReconnectDelay=20&maxReconnectDelay=1000&randomize=false

I don't see any reconnection tries. 
All the log files say is: 

Waking up reconnect task
org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Attempting
connect to: tcp://localhost:61617



selezovikj wrote:
> 
> Yes, I am sure. 
> When I have providerURL=tcp://localhost:61617 only, it connects with no
> problems
> 
> 
> 
> James.Strachan wrote:
>> 
>> 2008/10/16 selezovikj <se...@gmail.com>:
>>>
>>> You are right.
>>> However, what I get is:
>>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Waking
>>> up
>>> reconnect task
>>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  -
>>> Attempting
>>> connect to: tcp://localhost:61617
>> 
>> You sure you've got the right port number?
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://fusesource.com/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Log4j-JMS-appender---failover-tp20010627s22882p20014231.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Log4j JMS appender - failover

Posted by selezovikj <se...@gmail.com>.
And can you answer this question to me: 

I have another question. In my jndi.properties file I have the following
information:

java.naming.factory.initial =
org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url =
failover://(tcp://localhost:61617,tcp://localhost:61616)?randomize=false
topic.LoggingTopic = LoggingTopic

Then in the log4j.properties my JMS appender is like this:

log4j.appender.jms=org.apache.log4j.net.JMSAppender
log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
log4j.appender.jms.ProviderURL=failover://(tcp://localhost:61617,tcp://localhost:61616)?randomize=false
log4j.appender.jms.TopicBindingName=LoggingTopic
log4j.appender.jms.topicConnectionFactoryBindingName=ConnectionFactory
log4j.appender.jms.layout=org.apache.log4j.PatternLayout
log4j.appender.jms.layout.ConversionPattern=%d#%c{1}#STATS#%x%m%n
------------------------------------------------------------------------------------------------------------------

WHY should I specify the initialContextFactoryName again, the providerURL
again ? 




selezovikj wrote:
> 
> Yes, I am sure. 
> When I have providerURL=tcp://localhost:61617 only, it connects with no
> problems
> 
> 
> 
> James.Strachan wrote:
>> 
>> 2008/10/16 selezovikj <se...@gmail.com>:
>>>
>>> You are right.
>>> However, what I get is:
>>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Waking
>>> up
>>> reconnect task
>>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  -
>>> Attempting
>>> connect to: tcp://localhost:61617
>> 
>> You sure you've got the right port number?
>> 
>> -- 
>> James
>> -------
>> http://macstrac.blogspot.com/
>> 
>> Open Source Integration
>> http://fusesource.com/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Log4j-JMS-appender---failover-tp20010627s22882p20012332.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Log4j JMS appender - failover

Posted by selezovikj <se...@gmail.com>.
Yes, I am sure. 
When I have providerURL=tcp://localhost:61617 only, it connects with no
problems



James.Strachan wrote:
> 
> 2008/10/16 selezovikj <se...@gmail.com>:
>>
>> You are right.
>> However, what I get is:
>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Waking
>> up
>> reconnect task
>> org.apache.activemq.transport.failover.FailoverTransport DEBUG  -
>> Attempting
>> connect to: tcp://localhost:61617
> 
> You sure you've got the right port number?
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Log4j-JMS-appender---failover-tp20010627s22882p20012279.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Log4j JMS appender - failover

Posted by James Strachan <ja...@gmail.com>.
2008/10/16 selezovikj <se...@gmail.com>:
>
> You are right.
> However, what I get is:
> org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Waking up
> reconnect task
> org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Attempting
> connect to: tcp://localhost:61617

You sure you've got the right port number?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Log4j JMS appender - failover

Posted by selezovikj <se...@gmail.com>.
You are right. 
However, what I get is: 
org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Waking up
reconnect task
org.apache.activemq.transport.failover.FailoverTransport DEBUG  - Attempting
connect to: tcp://localhost:61617

And it does not connect. 

I have another question. In my jndi.properties file I have the following
information: 

java.naming.factory.initial =
org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url =
failover://(tcp://localhost:61617,tcp://localhost:61616)?randomize=false
topic.LoggingTopic = LoggingTopic

Then in the log4j.properties my JMS appender is like this: 

log4j.appender.jms=org.apache.log4j.net.JMSAppender
log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
log4j.appender.jms.ProviderURL=failover://(tcp://localhost:61617,tcp://localhost:61616)?randomize=false
log4j.appender.jms.TopicBindingName=LoggingTopic
log4j.appender.jms.topicConnectionFactoryBindingName=ConnectionFactory
log4j.appender.jms.layout=org.apache.log4j.PatternLayout
log4j.appender.jms.layout.ConversionPattern=%d#%c{1}#STATS#%x%m%n
------------------------------------------------------------------------------------------------------------------

WHY should I specify the initialContextFactoryName again, the providerURL
again ? 




James.Strachan wrote:
> 
> 2008/10/16 selezovikj <se...@gmail.com>:
>>
>> I want to be logging to a primary host, and in case it fails to a
>> secondary
>> host.
>> However log4j does not support the failover keyword.
>>
>> log4j.appender.jms.ProviderURL=failover:(tcp://localhost:61617,
>> tcp://localhost:61616)?randomize=false
>>
>> It complains in the following way:
>>
>> log4j:ERROR Error while activating options for appender named [jms].
>> javax.naming.NamingException: Invalid broker URL
>>        at
>> org.apache.activemq.jndi.ActiveMQInitialContextFactory.getInitialContext(ActiveMQInitialContextFactory.java:67)
>>        at
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> 
> This exception looks like its nothing to do with that setting - it
> looks to be an issue creating the initial JNDI context (in the JNDI
> properties file)
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Log4j-JMS-appender---failover-tp20010627s22882p20011788.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Log4j JMS appender - failover

Posted by James Strachan <ja...@gmail.com>.
2008/10/16 selezovikj <se...@gmail.com>:
>
> I want to be logging to a primary host, and in case it fails to a secondary
> host.
> However log4j does not support the failover keyword.
>
> log4j.appender.jms.ProviderURL=failover:(tcp://localhost:61617,
> tcp://localhost:61616)?randomize=false
>
> It complains in the following way:
>
> log4j:ERROR Error while activating options for appender named [jms].
> javax.naming.NamingException: Invalid broker URL
>        at
> org.apache.activemq.jndi.ActiveMQInitialContextFactory.getInitialContext(ActiveMQInitialContextFactory.java:67)
>        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

This exception looks like its nothing to do with that setting - it
looks to be an issue creating the initial JNDI context (in the JNDI
properties file)

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/