diff --git a/src/OmniSharp.Stdio/Host.cs b/src/OmniSharp.Stdio/Host.cs index 4cc441794f..97cb8d057e 100644 --- a/src/OmniSharp.Stdio/Host.cs +++ b/src/OmniSharp.Stdio/Host.cs @@ -232,9 +232,11 @@ private async Task HandleRequest(string json, ILogger logger) } finally { - if (logger.IsEnabled(LogLevel.Debug)) + // response gets logged when Debug or more detailed log level is enabled + // or when we have unsuccessful response (exception) + if (logger.IsEnabled(LogLevel.Debug) || !response.Success) { - LogResponse(response.ToString(), logger); + LogResponse(response.ToString(), logger, response.Success); } // actually write it @@ -257,14 +259,22 @@ void LogRequest(string json, ILogger logger) } } - void LogResponse(string json, ILogger logger) + void LogResponse(string json, ILogger logger, bool isSuccess) { var builder = _cachedStringBuilder.Acquire(); try { builder.AppendLine("************ Response ************ "); builder.Append(JToken.Parse(json).ToString(Formatting.Indented)); - logger.LogDebug(builder.ToString()); + + if (isSuccess) + { + logger.LogDebug(builder.ToString()); + } + else + { + logger.LogError(builder.ToString()); + } } finally {