diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/BufferBridge.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/BufferBridge.java index 3feab9a77..db8ff7414 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/BufferBridge.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/BufferBridge.java @@ -31,7 +31,7 @@ public BufferBridge(Vertx vertx) { } protected void pump() { - vertx.runOnContext(event -> { + vertx.runOnContext(nothing -> { try { if (!queue.isEmpty()) { log.trace("Pumping from queue"); @@ -60,6 +60,8 @@ protected void doWrite(Buffer chunk) { } catch (Exception e) { if (exceptionHandler != null) { exceptionHandler.handle(e); + }else{ + log.warn("TODO error handling", e); } } } else { @@ -80,6 +82,8 @@ protected Future doEnd() { } catch (Exception e) { if (exceptionHandler != null) { exceptionHandler.handle(e); + }else{ + log.warn("TODO error handling", e); } } endHandler = null; diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java index c4963a4fb..b81b10093 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java @@ -2,9 +2,21 @@ import io.netty.handler.codec.http.QueryStringDecoder; import io.vertx.codegen.annotations.Nullable; -import io.vertx.core.*; +import io.vertx.core.AsyncResult; +import io.vertx.core.Future; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.Promise; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; -import io.vertx.core.http.*; +import io.vertx.core.http.Cookie; +import io.vertx.core.http.HttpClientRequest; +import io.vertx.core.http.HttpClientResponse; +import io.vertx.core.http.HttpConnection; +import io.vertx.core.http.HttpMethod; +import io.vertx.core.http.HttpServerRequest; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.http.HttpVersion; import io.vertx.core.http.impl.headers.HeadersMultiMap; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -12,7 +24,13 @@ import io.vertx.core.net.SocketAddress; import io.vertx.core.net.impl.SocketAddressImpl; import io.vertx.ext.auth.User; -import io.vertx.ext.web.*; +import io.vertx.ext.web.FileUpload; +import io.vertx.ext.web.LanguageHeader; +import io.vertx.ext.web.ParsedHeaderValues; +import io.vertx.ext.web.Route; +import io.vertx.ext.web.RoutingContext; +import io.vertx.ext.web.Session; +import org.slf4j.Logger; import javax.net.ssl.SSLSession; import javax.security.cert.X509Certificate; @@ -21,12 +39,15 @@ import java.util.Map; import java.util.Set; +import static org.slf4j.LoggerFactory.getLogger; + /** * Bridges a HttpClientRequest to a HttpServerRequest sent to a request handler. * * @author https://github.com/lbovet [Laurent Bovet] */ public class LocalHttpClientRequest extends BufferBridge implements FastFailHttpClientRequest { + private static final Logger log = getLogger(LocalHttpClientRequest.class); private MultiMap headers = new HeadersMultiMap(); private MultiMap params; private HttpMethod method; @@ -776,6 +797,8 @@ public boolean writeQueueFull() { @Override public HttpClientRequest drainHandler(Handler handler) { + log.warn("Happy debugging, as this impl will just ignore your drainHandler anyway", + new Exception("may this stacktrace lead you where this problem comes from")); return this; } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java index 3f9aeeccb..e2839c511 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java @@ -9,6 +9,8 @@ import io.vertx.core.http.Http2Settings; import io.vertx.core.http.HttpConnection; import io.vertx.core.net.SocketAddress; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; @@ -16,11 +18,16 @@ import java.security.cert.Certificate; import java.util.List; +import static org.slf4j.LoggerFactory.getLogger; + /** * this is a mock-connection object which silently ignores (nearly) HTTP/1.1 relevant method calls and never throws exceptions * we need this to be able to set appropriate exception- and close-handlers in e.g. Gateleen's Forwarder (gateleen-routing) */ public class LocalHttpConnection implements HttpConnection { + + private static final Logger log = getLogger(LocalHttpConnection.class); + @Override public HttpConnection goAway(long errorCode, int lastStreamId, Buffer debugData) { throw new UnsupportedOperationException("LocalConnection don't support this"); @@ -48,6 +55,8 @@ public Future shutdown(long timeoutMs) { @Override public HttpConnection closeHandler(Handler handler) { + log.warn("Happy debugging, as this impl is going to ignore your closeHandler anyway", + new Exception("may this stacktrace help you")); return this; } @@ -99,6 +108,8 @@ public HttpConnection pingHandler(@Nullable Handler handler) { @Override public HttpConnection exceptionHandler(Handler handler) { + log.warn("Happy debugging, as this impl just ignores your exceptionHandler anyway", + new Exception("stacktrace")); return this; } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/logging/RequestLogger.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/logging/RequestLogger.java index aa10b7399..7b076895f 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/logging/RequestLogger.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/logging/RequestLogger.java @@ -41,7 +41,7 @@ public static void logRequest(EventBus eventBus, final HttpServerRequest request public static void logRequest(EventBus eventBus, final HttpServerRequest request, final int status, Buffer data, final MultiMap responseHeaders) { Logger log = RequestLoggerFactory.getLogger(RequestLogger.class, request); - log.info("Notify logging to eventually log the payload and headers of request to uri " + request.uri()); + log.info("Notify logging to eventually log the payload and headers of request to uri {}", request.uri()); JsonObject logEntry = new JsonObject(); logEntry.put(REQUEST_URI, request.uri()); logEntry.put(REQUEST_METHOD, request.method().name()); @@ -52,9 +52,9 @@ public static void logRequest(EventBus eventBus, final HttpServerRequest request eventBus.request(Address.requestLoggingConsumerAddress(), logEntry, (Handler>>) reply -> { if (reply.failed()) { - log.warn("Failed to log the payload and headers. Cause: " + reply.cause().getMessage()); + log.warn("Failed to log the payload and headers. Cause: {}", reply.cause().getMessage()); } else if (ERROR.equals(reply.result().body().getString("status"))) { - log.warn("Failed to log the payload and headers. Cause: " + reply.result().body().getString("message")); + log.warn("Failed to log the payload and headers. Cause: {}", reply.result().body().getString("message")); } }); }