Description
Setup:
- one embedded broker with a configured networkConnector:
<networkConnectors>
<networkConnector name="linkToParentBroker"
uri="static:(tcp://127.0.0.1:61617)" />
</networkConnectors>
- a logLevel that shows at leat WARN messages
- no other broker available (i.e. nobody is listening on tcp://127.0.0.1:61617)
I would expect to see a warning in the logfiles that indicates: "Hey, I'm not able to start the network bridge you configured". But instead it prints out the warning and a full stacktrace.
2014-03-27_13:01:21.777 [ActiveMQ Task-1] WARN o.a.a.network.DiscoveryNetworkConnector - Could not start network bridge between: vm://localhost?async=false&network=true and: tcp://127.0.0.1:61617 due to: {}
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.6.0_25]
at java.net.PlainSocketImpl.doConnect(Unknown Source) ~[na:1.6.0_25]
at java.net.PlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.6.0_25]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.6.0_25]
at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.6.0_25]
at java.net.Socket.connect(Unknown Source) ~[na:1.6.0_25]
at org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:496) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:459) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.transport.AbstractInactivityMonitor.start(AbstractInactivityMonitor.java:138) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:58) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.network.DemandForwardingBridgeSupport.start(DemandForwardingBridgeSupport.java:204) ~[activemq-all-5.9.0.jar:5.9.0]
at org.apache.activemq.network.DiscoveryNetworkConnector.onServiceAdd(DiscoveryNetworkConnector.java:152) ~[bin/:5.9.0]
at org.apache.activemq.transport.discovery.simple.SimpleDiscoveryAgent$1.run(SimpleDiscoveryAgent.java:184) [activemq-all-5.9.0.jar:5.9.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_25]
at java.lang.Thread.run(Unknown Source) [na:1.6.0_25]
Looking at the code (DiscoveryNetworkConnector.java) we can see that there are two logging statements. One Warning and one Debug:
LOG.warn("Could not start network bridge between: {} and: {} due to: {}", new Object[]{ localURI, uri, e }); LOG.debug("Start failure exception: ", e);
I think it would be sufficient if the warning logged only the message from the exception, but not the whole stacktrace.