You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2019/02/13 11:40:34 UTC
[mina-sshd] 02/05: Log caught session exception cause if available
This is an automated email from the ASF dual-hosted git repository.
lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
commit 23b9fd5d7b7faa0b3bc72e66bd9b176b3877e7f8
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Tue Feb 12 12:55:12 2019 +0200
Log caught session exception cause if available
---
.../apache/sshd/common/session/helpers/SessionHelper.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java
index a996d6d..41e85ac 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionHelper.java
@@ -1022,9 +1022,22 @@ public abstract class SessionHelper extends AbstractKexFactoryManager implements
return;
}
- log.warn("exceptionCaught({})[state={}] {}: {}", this, curState, t.getClass().getSimpleName(), t.getMessage());
+ log.warn("exceptionCaught({})[state={}] {}: {}",
+ this, curState, t.getClass().getSimpleName(), t.getMessage());
+ Throwable cause = t.getCause();
+ if ((cause != null) && GenericUtils.isSameReference(t, cause)) {
+ cause = null;
+ }
+ if (cause != null) {
+ log.warn("exceptionCaught({})[state={}] caused by {}: {}",
+ this, curState, cause.getClass().getSimpleName(), cause.getMessage());
+ }
+
if (log.isDebugEnabled()) {
log.debug("exceptionCaught(" + this + ")[state=" + curState + "] details", t);
+ if (cause != null) {
+ log.debug("exceptionCaught(" + this + ")[state=" + curState + "] cause", cause);
+ }
}
signalExceptionCaught(t);