From 5c2aaf638013e9b43de1ea2d31dee57feb23ae09 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 1 Apr 2019 16:13:37 +0200 Subject: [PATCH] Improve error logging on connection failure (cluster) --- lib/remote/apilistener.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 6da42b68c..de6e754c0 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -413,7 +413,8 @@ void ApiListener::ListenerCoroutineProc(boost::asio::yield_context yc, const std asio::spawn(io, [this, sslConn](asio::yield_context yc) { NewClientHandler(yc, sslConn, String(), RoleServer); }); } catch (const std::exception& ex) { - Log(LogCritical, "ApiListener") << "Cannot accept new connection: " << DiagnosticInformation(ex, false); + Log(LogCritical, "ApiListener") + << "Cannot accept new connection: " << DiagnosticInformation(ex, false); } } } @@ -457,11 +458,8 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint) } catch (const std::exception& ex) { endpoint->SetConnecting(false); - std::ostringstream info; - info << "Cannot connect to host '" << host << "' on port '" << port << "'"; - Log(LogCritical, "ApiListener", info.str()); - Log(LogDebug, "ApiListener") - << info.str() << "\n" << DiagnosticInformation(ex); + Log(LogCritical, "ApiListener") + << "Cannot connect to host '" << host << "' on port '" << port << "': " << ex.what(); } }); } -- 2.40.0