From: Alexander A. Klimov Date: Tue, 9 Apr 2019 11:53:41 +0000 (+0200) Subject: JsonRpcConnection: reduce log spam on disconnect X-Git-Tag: v2.11.0-rc1~156^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de04bb13a89a743235da3e30aa3fe7bb9506809e;p=icinga2 JsonRpcConnection: reduce log spam on disconnect --- diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index b850b7884..a7ec2cdff 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include #include using namespace icinga; @@ -61,7 +63,17 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc) message = JsonRpc::ReadMessage(m_Stream, yc, m_Endpoint ? -1 : 1024 * 1024); } catch (const std::exception& ex) { if (!m_ShuttingDown) { - Log(LogWarning, "JsonRpcConnection") + auto logLevelOnReadError (LogWarning); + + { + auto boostError (dynamic_cast(&ex)); + + if (boostError && boostError->code().category() == boost::asio::error::get_ssl_category()) { + logLevelOnReadError = LogNotice; + } + } + + Log(logLevelOnReadError, "JsonRpcConnection") << "Error while reading JSON-RPC message for identity '" << m_Identity << "': " << DiagnosticInformation(ex); }