Improve error logging on connection failure (cluster)

This commit is contained in:
Michael Friedrich 2019-04-01 16:13:37 +02:00
parent ebf9f9d9f5
commit 5c2aaf6380
1 changed files with 4 additions and 6 deletions

View File

@ -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); }); asio::spawn(io, [this, sslConn](asio::yield_context yc) { NewClientHandler(yc, sslConn, String(), RoleServer); });
} catch (const std::exception& ex) { } 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) { } catch (const std::exception& ex) {
endpoint->SetConnecting(false); endpoint->SetConnecting(false);
std::ostringstream info; Log(LogCritical, "ApiListener")
info << "Cannot connect to host '" << host << "' on port '" << port << "'"; << "Cannot connect to host '" << host << "' on port '" << port << "': " << ex.what();
Log(LogCritical, "ApiListener", info.str());
Log(LogDebug, "ApiListener")
<< info.str() << "\n" << DiagnosticInformation(ex);
} }
}); });
} }