<commit_before>////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License
////

// This module is included in the following assemblies:
//
// troubleshooting.adoc

[id='troubleshooting-using-logs-{context}']
= Troubleshooting using logs

You can use {RouterName} log entries to help diagnose error and performance issues with the routers in your network.

.Troubleshooting connections and links
====
In this example, `ROUTER` logs show the lifecycle of a connection and a link that is associated with it.

[options="nowrap"]
----
2019-04-05 14:54:38.037248 -0400 ROUTER (info) [C1] Connection Opened: dir=in host=127.0.0.1:55440 vhost= encrypted=no auth=no user=anonymous container_id=95e55424-6c0a-4a5c-8848-65a3ea5cc25a props= // <1>
2019-04-05 14:54:38.038137 -0400 ROUTER (info) [C1][L6] Link attached: dir=in source={<none> expire:sess} target={$management expire:sess} // <2>
2019-04-05 14:54:38.041103 -0400 ROUTER (info) [C1][L6] Link lost: del=1 presett=0 psdrop=0 acc=1 rej=0 rel=0 mod=0 delay1=0 delay10=0 // <3>
2019-04-05 14:54:38.041154 -0400 ROUTER (info) [C1] Connection Closed // <4>
----
<1> The connection is opened. Each connection has a unique ID (`C1`). The log also shows some information about the connection.
<2> A link is attached over the connection. The link is identified with a unique ID (`L6`). The log also shows the direction of the link, and the source and target addresses.
<3> The link is detached. The log shows the link's terminal statistics.
<4> The connection is closed.

NOTE: If necessary, you can use `qdmanage` to enable protocol-level trace logging for a particular connection. You can use this to trace the AMQP frames. For example:

[options="nowrap"]
----
$ qdmanage update --type=connection id=C1 enableProtocolTrace=true
----
====

.Troubleshooting the network topology
====
In this example, on `Router.A`, the `ROUTER_HELLO` logs show that it is connected to `Router.B`, and that `Router.B` is connected to `Router.A` and `Router.C`:

[options="nowrap"]
----
Tue Jun  7 13:50:21 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.B area=0 inst=1465307413 seen=['Router.A', 'Router.C']) // <1>
Tue Jun  7 13:50:21 2016 ROUTER_HELLO (trace) SENT: HELLO(id=Router.A area=0 inst=1465307416 seen=['Router.B']) // <2>
Tue Jun  7 13:50:22 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.B area=0 inst=1465307413 seen=['Router.A', 'Router.C'])
Tue Jun  7 13:50:22 2016 ROUTER_HELLO (trace) SENT: HELLO(id=Router.A area=0 inst=1465307416 seen=['Router.B'])
----
<1> `Router.A` received a Hello message from `Router.B`, which can see `Router.A` and `Router.C`.
<2> `Router.A` sent a Hello message to `Router.B`, which is the only router it can see.

On `Router.B`, the `ROUTER_HELLO` log shows the same router topology from a different perspective:

[options="nowrap"]
----
Tue Jun  7 13:50:18 2016 ROUTER_HELLO (trace) SENT: HELLO(id=Router.B area=0 inst=1465307413 seen=['Router.A', 'Router.C']) // <1>
Tue Jun  7 13:50:18 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.A area=0 inst=1465307416 seen=['Router.B']) // <2>
Tue Jun  7 13:50:19 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.C area=0 inst=1465307411 seen=['Router.B']) // <3>
----
<1> `Router.B` sent a Hello message to `Router.A` and `Router.C`.<commit_msg>DISPATCH-1629 - Added the missing "--" in qdmanage command. This closes #735.<commit_after>////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License
////

// This module is included in the following assemblies:
//
// troubleshooting.adoc

[id='troubleshooting-using-logs-{context}']
= Troubleshooting using logs

You can use {RouterName} log entries to help diagnose error and performance issues with the routers in your network.

.Troubleshooting connections and links
====
In this example, `ROUTER` logs show the lifecycle of a connection and a link that is associated with it.

[options="nowrap"]
----
2019-04-05 14:54:38.037248 -0400 ROUTER (info) [C1] Connection Opened: dir=in host=127.0.0.1:55440 vhost= encrypted=no auth=no user=anonymous container_id=95e55424-6c0a-4a5c-8848-65a3ea5cc25a props= // <1>
2019-04-05 14:54:38.038137 -0400 ROUTER (info) [C1][L6] Link attached: dir=in source={<none> expire:sess} target={$management expire:sess} // <2>
2019-04-05 14:54:38.041103 -0400 ROUTER (info) [C1][L6] Link lost: del=1 presett=0 psdrop=0 acc=1 rej=0 rel=0 mod=0 delay1=0 delay10=0 // <3>
2019-04-05 14:54:38.041154 -0400 ROUTER (info) [C1] Connection Closed // <4>
----
<1> The connection is opened. Each connection has a unique ID (`C1`). The log also shows some information about the connection.
<2> A link is attached over the connection. The link is identified with a unique ID (`L6`). The log also shows the direction of the link, and the source and target addresses.
<3> The link is detached. The log shows the link's terminal statistics.
<4> The connection is closed.

NOTE: If necessary, you can use `qdmanage` to enable protocol-level trace logging for a particular connection. You can use this to trace the AMQP frames. For example:

[options="nowrap"]
----
$ qdmanage update --type=connection --id=C1 enableProtocolTrace=true
----
====

.Troubleshooting the network topology
====
In this example, on `Router.A`, the `ROUTER_HELLO` logs show that it is connected to `Router.B`, and that `Router.B` is connected to `Router.A` and `Router.C`:

[options="nowrap"]
----
Tue Jun  7 13:50:21 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.B area=0 inst=1465307413 seen=['Router.A', 'Router.C']) // <1>
Tue Jun  7 13:50:21 2016 ROUTER_HELLO (trace) SENT: HELLO(id=Router.A area=0 inst=1465307416 seen=['Router.B']) // <2>
Tue Jun  7 13:50:22 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.B area=0 inst=1465307413 seen=['Router.A', 'Router.C'])
Tue Jun  7 13:50:22 2016 ROUTER_HELLO (trace) SENT: HELLO(id=Router.A area=0 inst=1465307416 seen=['Router.B'])
----
<1> `Router.A` received a Hello message from `Router.B`, which can see `Router.A` and `Router.C`.
<2> `Router.A` sent a Hello message to `Router.B`, which is the only router it can see.

On `Router.B`, the `ROUTER_HELLO` log shows the same router topology from a different perspective:

[options="nowrap"]
----
Tue Jun  7 13:50:18 2016 ROUTER_HELLO (trace) SENT: HELLO(id=Router.B area=0 inst=1465307413 seen=['Router.A', 'Router.C']) // <1>
Tue Jun  7 13:50:18 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.A area=0 inst=1465307416 seen=['Router.B']) // <2>
Tue Jun  7 13:50:19 2016 ROUTER_HELLO (trace) RCVD: HELLO(id=Router.C area=0 inst=1465307411 seen=['Router.B']) // <3>
----
<1> `Router.B` sent a Hello message to `Router.A` and `Router.C`.
{'fraction_non_alphanumeric': 0.1234984984984985, 'fraction_numerical': 0.08170670670670671, 'mean_word_length': 4.520027624309392, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4668468', 'n_tokens_mistral': 3088, 'n_tokens_neox': 2676, 'n_words': 1020}