Permalink
Browse files

Enhance logging in NetconfSessionImpl

There are a few places where Throwable.getMessage() is emitted directly
instead of utilizing a Throwable argument to the Logger output methods.
Using debug as an example, when dealing with exception reporting cases,
it is, generally better to rely upon:

http://www.slf4j.org/api/org/slf4j/Logger.html#debug(java.lang.String, java.lang.Throwable)

than:

http://www.slf4j.org/api/org/slf4j/Logger.html#debug(java.lang.String)

This commit also cleans up the language of another log message.

Change-Id: I53a77286069c112aafc83ad8157a439a4d50e52e
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
  • Loading branch information...
1 parent fb4b04a commit 69524397a611d57df3736f3338379f2855869e7f @ryandgoulding ryandgoulding committed with jonohart Dec 3, 2016
@@ -129,8 +129,8 @@ private void startConnection() throws NetconfException {
deviceInfo.name(), deviceInfo.password());
}
} catch (IOException e) {
- log.error("Authentication connection to device {} failed: {} ",
- deviceInfo.getDeviceId(), e.getMessage());
+ log.error("Authentication connection to device {} failed",
+ deviceInfo.getDeviceId(), e);
throw new NetconfException("Authentication connection to device " +
deviceInfo.getDeviceId() + " failed", e);
}
@@ -154,7 +154,7 @@ private void startSshSession() throws NetconfException {
this.addDeviceOutputListener(new NetconfDeviceOutputEventListenerImpl(deviceInfo));
sendHello();
} catch (IOException e) {
- log.error("Failed to create ch.ethz.ssh2.Session session." + e.getMessage());
+ log.error("Failed to create ch.ethz.ssh2.Session session.", e);
throw new NetconfException("Failed to create ch.ethz.ssh2.Session session with device" +
deviceInfo, e);
}
@@ -246,7 +246,7 @@ private void checkAndRestablishSession() throws NetconfException {
try {
startSshSession();
} catch (IOException e) {
- log.debug("The connection with {} had to be reopened", deviceInfo.getDeviceId());
+ log.debug("The connection with {} was reopened", deviceInfo.getDeviceId());
try {
startConnection();
} catch (IOException e2) {

0 comments on commit 6952439

Please sign in to comment.