Improve TLS handshake exception logging

refs #6602
This commit is contained in:
Noah Hilverling 2018-09-06 15:58:42 +02:00 committed by Michael Friedrich
parent 2831991db4
commit eda3c3ade3
5 changed files with 8 additions and 6 deletions

View File

@ -434,7 +434,7 @@ void ElasticsearchWriter::SendRequest(const String& body)
stream = Connect(); stream = Connect();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogWarning, "ElasticsearchWriter") Log(LogWarning, "ElasticsearchWriter")
<< "Flush failed, cannot connect to Elasticsearch."; << "Flush failed, cannot connect to Elasticsearch: " << DiagnosticInformation(ex, false);
return; return;
} }

View File

@ -425,7 +425,7 @@ void InfluxdbWriter::Flush()
stream = Connect(); stream = Connect();
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
Log(LogWarning, "InfluxDbWriter") Log(LogWarning, "InfluxDbWriter")
<< "Flush failed, cannot connect to InfluxDB."; << "Flush failed, cannot connect to InfluxDB: " << DiagnosticInformation(ex, false);
return; return;
} }

View File

@ -454,9 +454,9 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
try { try {
tlsStream->Handshake(); tlsStream->Handshake();
} catch (const std::exception&) { } catch (const std::exception& ex) {
Log(LogCritical, "ApiListener") Log(LogCritical, "ApiListener")
<< "Client TLS handshake failed (" << conninfo << ")"; << "Client TLS handshake failed (" << conninfo << "): " << DiagnosticInformation(ex, false);
tlsStream->Close(); tlsStream->Close();
return; return;
} }

View File

@ -187,8 +187,9 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
try { try {
stream->Handshake(); stream->Handshake();
} catch (const std::exception&) { } catch (const std::exception& ex) {
Log(LogCritical, "cli", "Client TLS handshake failed."); Log(LogCritical, "cli")
<< "Client TLS handshake failed: " << DiagnosticInformation(ex, false);
return 1; return 1;
} }

View File

@ -21,6 +21,7 @@
#define PKIUTILITY_H #define PKIUTILITY_H
#include "remote/i2-remote.hpp" #include "remote/i2-remote.hpp"
#include "base/exception.hpp"
#include "base/dictionary.hpp" #include "base/dictionary.hpp"
#include "base/string.hpp" #include "base/string.hpp"
#include <openssl/x509v3.h> #include <openssl/x509v3.h>