I am logging messages using log4j to a queue on an ActiveMQBroker.
Now, I want dependent on whether a flag is on to be able to log to a broker
specified by let's say: java.naming.provider.url = tcp://machineA:61616, and
if it is off to log to java.naming.provider.url = tcp://machineB:61616
When log4j is started it sees whether a jndi.properties file is present and
sets the values.
I want to get the instance that started the JmsAppender and the the Context
from it.
// getting the jndi context
InitialContext jndiContext = queueAppender.getInitialContext();
// setting the providerUrl dependent on the flag
// the provider.url will be absent from the jndi.properties file, so that it
can be set depending on the flag
if(flagIsOn) {
jndiContext.addToEnvironment("java.naming.provider.url",
"tcp://machineA:61616)");
} else {
jndiContext.addToEnvironment("java.naming.provider.url",
"tcp://machineB:61616)");
}
Can anyone give advice on how to get the instance ... and set the
provider.url ...
I don't how to get the instance of log4j that initializedJndi and set the
environment values.
--
View this message in context:
http://www.nabble.com/JmsAppender---multiple-java.naming.provider.url-tp21688853p21688853.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.