Merge pull request #7968 from Icinga/bugfix/jsonrpcconnection-disconnect-log

JsonRpcConnection: always log errors
This commit is contained in:
Alexander Aleksandrovič Klimov 2021-03-08 10:55:55 +01:00 committed by GitHub
commit d169abc22c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,11 +68,9 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc)
try { try {
message = JsonRpc::ReadMessage(m_Stream, yc, m_Endpoint ? -1 : 1024 * 1024); message = JsonRpc::ReadMessage(m_Stream, yc, m_Endpoint ? -1 : 1024 * 1024);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
if (!m_ShuttingDown) { Log(m_ShuttingDown ? LogDebug : LogNotice, "JsonRpcConnection")
Log(LogNotice, "JsonRpcConnection") << "Error while reading JSON-RPC message for identity '" << m_Identity
<< "Error while reading JSON-RPC message for identity '" << m_Identity << "': " << DiagnosticInformation(ex);
<< "': " << DiagnosticInformation(ex);
}
break; break;
} }
@ -84,11 +82,9 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc)
MessageHandler(message); MessageHandler(message);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
if (!m_ShuttingDown) { Log(m_ShuttingDown ? LogDebug : LogWarning, "JsonRpcConnection")
Log(LogWarning, "JsonRpcConnection") << "Error while processing JSON-RPC message for identity '" << m_Identity
<< "Error while processing JSON-RPC message for identity '" << m_Identity << "': " << DiagnosticInformation(ex);
<< "': " << DiagnosticInformation(ex);
}
break; break;
} }
@ -125,12 +121,9 @@ void JsonRpcConnection::WriteOutgoingMessages(boost::asio::yield_context yc)
m_Stream->async_flush(yc); m_Stream->async_flush(yc);
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
if (!m_ShuttingDown) { Log(m_ShuttingDown ? LogDebug : LogWarning, "JsonRpcConnection")
std::ostringstream info; << "Error while sending JSON-RPC message for identity '"
info << "Error while sending JSON-RPC message for identity '" << m_Identity << "'"; << m_Identity << "'\n" << DiagnosticInformation(ex);
Log(LogWarning, "JsonRpcConnection")
<< info.str() << "\n" << DiagnosticInformation(ex);
}
break; break;
} }