Hi, I'm trying to add a JMS appender in Java rather than the log4j.properties file. It doesn't seem to get added correctly. I'm using log4j 1.2. When I turn log4j debugging on I see the following error:
log4j:ERROR No TopicConnection for JMSAppender named [null]. Here's the code I use to add the appender: javax.naming.Context ctx = new javax.naming.InitialContext(); javax.jms.TopicConnectionFactory factory = (javax.jms.TopicConnectionFactory) ctx.lookup("ConnectionFactory"); javax.jms.TopicConnection conn = factory.createTopicConnection(); javax.jms.Topic mytopic = (javax.jms.Topic) ctx.lookup("JMSLog"); javax.jms.TopicSession session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE); javax.jms.TopicSubscriber subscriber = session.createSubscriber(mytopic); JMSAppender appender = new JMSAppender(); appender.setLayout(new PatternLayout("%d [%t] %-5p %c - %m%n")); appender.setInitialContextFactoryName("org.apache.activemq.jndi.ActiveMQInitialContextFactory"); appender.setProviderURL("tcp://localhost:61616"); appender.setTopicBindingName("JMSLog"); appender.setTopicConnectionFactoryBindingName("org.apache.activemq.ActiveMQConnectionFactory"); Logger.getRootLogger().addAppender(appender); My log4j.properties defines a ConsoleAppender and NTEventLogAppener. My jdni.properties is the following: java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory java.naming.provider.url=tcp://localhost:61616 topic.JMSLog=JMSLog I've been playing with this all day and can't seem to get it work or find anything that helps me on the web. Any ideas? Thanks, -Mike