Repository: reef Updated Branches: refs/heads/master 3ea89be97 -> a2278b4db
[REEF-1623] Remove double-logging exception in Logger.Log(Exception) This change * removes logging of exception.Message and exception.StackTrace which are logged as part of exception anyways. * cleans up logic of when message is logged. JIRA: [REEF-1623](https://issues.apache.org/jira/browse/REEF-1623) Pull request: This closes #1137 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/a2278b4d Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/a2278b4d Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/a2278b4d Branch: refs/heads/master Commit: a2278b4db74f6b60b41f1b4c1e848edaa3453de5 Parents: 3ea89be Author: Mariia Mykhailova <[email protected]> Authored: Tue Sep 27 17:36:13 2016 -0700 Committer: Markus Weimer <[email protected]> Committed: Wed Sep 28 11:33:11 2016 -0700 ---------------------------------------------------------------------- .../Org.Apache.REEF.Utilities/Logging/Logger.cs | 31 ++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/a2278b4d/lang/cs/Org.Apache.REEF.Utilities/Logging/Logger.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Utilities/Logging/Logger.cs b/lang/cs/Org.Apache.REEF.Utilities/Logging/Logger.cs index ec05ec2..1733639 100644 --- a/lang/cs/Org.Apache.REEF.Utilities/Logging/Logger.cs +++ b/lang/cs/Org.Apache.REEF.Utilities/Logging/Logger.cs @@ -173,23 +173,24 @@ namespace Org.Apache.REEF.Utilities.Logging public void Log(Level level, string msg, Exception exception) { - string exceptionLog; - - if (IsLoggable(level) && exception != null) - { - exceptionLog = string.Format( - CultureInfo.InvariantCulture, - "encountered error [{0}] with mesage [{1}] and stack trace [{2}]", - exception, - exception.Message, - exception.StackTrace); - } - else + if (IsLoggable(level)) { - exceptionLog = string.Empty; + string exceptionLog; + + if (exception != null) + { + exceptionLog = string.Format( + CultureInfo.InvariantCulture, + "\r\nEncountered error [{0}]", + exception); + } + else + { + exceptionLog = string.Empty; + } + + Log(level, msg + exceptionLog); } - - Log(level, msg + exceptionLog); } public IDisposable LogFunction(string function, params object[] args)
