diff options
author | Jo Kristian Bergum <bergum@yahoo-inc.com> | 2019-08-09 15:09:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-09 15:09:28 +0200 |
commit | ce655c3e9c3260ef67cbdd2f765c63ac5fb43498 (patch) | |
tree | e85a97d2161c63a99b7e93e4ddb8d55935a88d17 | |
parent | 7554d4d0b49eb8cf4b4aea17baffe96eeeb64d83 (diff) | |
parent | 8076f0ac2d60eabd7f7c471cf1ea1ee5bf988a78 (diff) |
Merge pull request #10222 from vespa-engine/jobergum/improve-logging
Improve log messages and include response code
-rw-r--r-- | vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java index 8ec4f6cb7f4..643b7641e68 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java @@ -303,14 +303,16 @@ class IOThread implements Runnable, AutoCloseable { case DISCONNECTED: try { if (! client.connect()) { - log.log(Level.WARNING, "Connect returned null " + endpoint); + log.log(Level.WARNING, "Could not connect to endpoint: '" + endpoint + "'. Will re-try."); drainFirstDocumentsInQueueIfOld(); return ThreadState.DISCONNECTED; } return ThreadState.CONNECTED; } catch (Throwable throwable1) { drainFirstDocumentsInQueueIfOld(); - log.log(Level.INFO, "Connect did not work out " + endpoint, throwable1); + + log.log(Level.INFO, "Failed connecting to endpoint: '" + endpoint + + "'. Will re-try connecting. Failed with '" + Exceptions.toMessageString(throwable1) + "'",throwable1); executeProblemsCounter.incrementAndGet(); return ThreadState.DISCONNECTED; } @@ -319,15 +321,19 @@ class IOThread implements Runnable, AutoCloseable { client.handshake(); successfulHandshakes.getAndIncrement(); } catch (ServerResponseException ser) { + executeProblemsCounter.incrementAndGet(); - log.info("Handshake did not work out " + endpoint + ": " + Exceptions.toMessageString(ser)); + log.log(Level.INFO, "Failed talking to endpoint. Handshake with server endpoint '" + endpoint + + "' failed. Will re-try handshake. Failed with '" + Exceptions.toMessageString(ser) + "'",ser); + drainFirstDocumentsInQueueIfOld(); resultQueue.onEndpointError(new FeedProtocolException(ser.getResponseCode(), ser.getResponseString(), ser, endpoint)); return ThreadState.CONNECTED; } catch (Throwable throwable) { // This cover IOException as well executeProblemsCounter.incrementAndGet(); resultQueue.onEndpointError(new FeedConnectException(throwable, endpoint)); - log.info("Problem with Handshake " + endpoint + ": " + Exceptions.toMessageString(throwable)); + log.log(Level.INFO, "Failed talking to endpoint. Handshake with server endpoint '" + endpoint + + "' failed. Will re-try handshake. Failed with '" + Exceptions.toMessageString(throwable) + "'",throwable); drainFirstDocumentsInQueueIfOld(); client.close(); return ThreadState.DISCONNECTED; @@ -339,11 +345,14 @@ class IOThread implements Runnable, AutoCloseable { gatewayThrottler.handleCall(processResponse.transitiveErrorCount); } catch (ServerResponseException ser) { - log.info("Problems while handing data over to gateway " + endpoint + ": " + Exceptions.toMessageString(ser)); + log.log(Level.INFO, "Problems while handing data over to endpoint '" + endpoint + + "'. Will re-try. Endpoint responded with an unexpected HTTP response code. '" + + Exceptions.toMessageString(ser) + "'",ser); return ThreadState.CONNECTED; } catch (Throwable e) { // Covers IOException as well - log.info("Problems while handing data over to gateway " + endpoint + ": " + Exceptions.toMessageString(e)); + log.log(Level.INFO, "Problems while handing data over to endpoint '" + endpoint + + "'. Will re-try. Connection level error. Failed with '" + Exceptions.toMessageString(e) + "'", e); client.close(); return ThreadState.DISCONNECTED; } |