@Joe - I set the PROVIDER_URL immediately after log4j calls the InitialContext() constructor.
@James - Will try that first thing in the morning Joe Fernandez wrote: > > Are you extending Jamie Tsao's JMSQueueAppender? > > Is your activateOptions() method being called prior to you setting the > PROVIDER_URL? > > Joe > Free ActiveMQ user guide @ http://www.ttmsolutions.com > > > > selezovikj wrote: >> >> I have a JmsQueueAppender that logs messages to an ActiveMQ broker on a >> given queue. >> I also have a jndi.properties file in which I do NOT specify the >> provider.url value, because that value can vary depending on a flag. >> >> In my JmsQueueAppender, the jndi context is initialized using the default >> no-argument constructor. >> >> >> jndi = new InitialContext(); >> System.out.println(jndi.getEnvironment().toString()); >> >> Printing the environment values which are gotten using the default >> constructor results with the following values which I have specified in >> my jndi.properties file: >> {java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory, >> queue.LoggingQueue=LoggingQueue} >> >> Later I add to the environment the provider.url value. >> >> jndi.addToEnvironment(Context.PROVIDER_URL, >> "failover:(tcp://localhost:61617)"); >> System.out.println(jndi.getEnvironment().toString()); >> >> results with: >> {java.naming.provider.url=failover:(tcp://localhost:61617), >> java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory, >> queue.LoggingQueue=LoggingQueue} >> >> Even though, the provider.url is added to the environment, when logging >> log4j does not take into account the provider url I just specified. It >> simply does not log to 61617. >> >> Any help with this ? ? ? >> > > -- View this message in context: http://www.nabble.com/log4j---Jndi-context-addToEnvironment-has-no-effect-tp21731483p21732834.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.