0
votes

I am trying to use Log4j JMSAppender using xml style configuration file, My log4j.xml is the same as https://code.google.com/p/log4j-jms-sample/source/browse/trunk/src/main/resources/log4j.xml except the topicName.
And the Test code is very simple:

public static void main(String[] args) throws Exception {
    Logger logger = Logger.getLogger(Main.class);
    logger.debug("Debug");
    logger.info("Info");
    logger.warn("Warn");
    logger.error("Error");
    logger.fatal("Fatal");
}

But I always got this error during testing:

javax.jms.JMSException: Wire format negotiation timeout: peer did not send his wire format.
    at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1395)
    at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1481)
    at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:323)
    at org.apache.activemq.ActiveMQConnection.createTopicSession(ActiveMQConnection.java:1112)

My ActiveMQ is alive, but it gives a warn message every time when above exception occurred: enter image description here

I have search for a whole afternoon to try to get solution but with no luck. This page gives me some hints and I also referenced this page, but they didn't help me solve my problem.

I know how to use log4j.properties instead of log4j.xml, but what I want to know is why this error occurs and how to solve it.

Hope some one could help me. Thanks a lot.

I'm using ActiveMQ-5.12.0, Log4j-1.2.17, Windows 7 platform.

1

1 Answers

0
votes

Finally, I solved this problem from here.

The 2nd situation, I note there is a configuration in log4j.properties way in this page:

## Be sure that ActiveMQ messages are not logged to 'jms' appender
log4j.logger.org.apache.activemq=INFO, stdout

I checked my log4j.xml, it only contains appender config:

<logger name="org.apache.activemq">
    <appender-ref ref="console" />
</logger>

but not include the log level config. So I change it to:

<logger name="org.apache.activemq">
    <level value="INFO" />
    <appender-ref ref="console" />
</logger>

And this time, error disappears.