diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java index 6bb085096..fa0720a04 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-enricher/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpEnricher.java @@ -16,7 +16,7 @@ public class LdioHttpEnricher extends LdioTransformer { - private static final Logger LOGGER = LoggerFactory.getLogger(LdioHttpEnricher.class); + private static final Logger log = LoggerFactory.getLogger(LdioHttpEnricher.class); private final LdiAdapter adapter; private final RequestExecutor requestExecutor; @@ -34,7 +34,7 @@ public void apply(Model model) { final Request request = createRequest(model); final Response response = requestExecutor.execute(request); - LOGGER.info(request.getMethod() + " " + request.getUrl() + " " + response.getHttpStatus()); + log.debug(request.getMethod() + " " + request.getUrl() + " " + response.getHttpStatus()); addResponseToModel(model, response); this.next(model); @@ -100,7 +100,7 @@ private void addResponseToModel(Model model, Response response) { .toList() .forEach(model::add); } else { - LOGGER.atWarn().log("Failed to enrich model. The request url was {}. " + + log.atWarn().log("Failed to enrich model. The request url was {}. " + "The http response obtained from the server has code {} and body \"{}\".", response.getRequestedUrl(), response.getHttpStatus(), response.getBody().orElse(null)); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpInputPoller.java b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpInputPoller.java index a6bf12f8e..97057a9bf 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpInputPoller.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in-poller/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/HttpInputPoller.java @@ -25,7 +25,7 @@ public class HttpInputPoller extends LdiInput { private final RequestExecutor requestExecutor; private final List requests; private final boolean continueOnFail; - private static final Logger LOGGER = LoggerFactory.getLogger(HttpInputPoller.class); + private static final Logger log = LoggerFactory.getLogger(HttpInputPoller.class); private static final String CONTENT_TYPE = "Content-Type"; public HttpInputPoller(ComponentExecutor executor, LdiAdapter adapter, List endpoints, @@ -46,7 +46,7 @@ public void poll() { try { executeRequest(request); } catch (Exception e) { - LOGGER.error(e.getMessage()); + log.error(e.getMessage()); if (!continueOnFail) { throw e; } @@ -55,11 +55,11 @@ public void poll() { } private void executeRequest(Request request) { - LOGGER.atDebug().log("Polling next url: {}", request.getUrl()); + log.atDebug().log("Polling next url: {}", request.getUrl()); Response response = requestExecutor.execute(request); - LOGGER.info(request.getMethod() + " " + request.getUrl() + " " + response.getHttpStatus()); + log.debug(request.getMethod() + " " + request.getUrl() + " " + response.getHttpStatus()); if (HttpStatusCode.valueOf(response.getHttpStatus()).is2xxSuccessful()) { String contentType = response.getFirstHeaderValue(CONTENT_TYPE) diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpIn.java b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpIn.java index 0aa1d6370..0c99266f2 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpIn.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-in/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpIn.java @@ -6,8 +6,10 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.types.LdiInput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; +import org.springframework.web.reactive.function.server.ServerRequest; import org.springframework.web.reactive.function.server.ServerResponse; import java.util.NoSuchElementException; @@ -17,7 +19,7 @@ public class LdioHttpIn extends LdiInput { - private static final Logger LOGGER = LoggerFactory.getLogger(LdioHttpIn.class); + private static final Logger log = LoggerFactory.getLogger(LdioHttpIn.class); private final String endpoint; public LdioHttpIn(ComponentExecutor executor, LdiAdapter adapter, String endpoint) { @@ -32,9 +34,7 @@ public RouterFunction mapping() { .orElseThrow(() -> new NoSuchElementException("No Content-Type header found")) .toString(); - String type = req.headers().contentType().map(MediaType::toString).orElse("(unknown)"); - LOGGER.info("POST " + "/%s".formatted(endpoint) + " type:" + type + " length:" - + req.headers().contentLength().orElse(0L)); + logIncomingRequest(req); return req.bodyToMono(String.class) .doOnNext(content -> getAdapter().apply(Content.of(content, contentType)) @@ -43,4 +43,11 @@ public RouterFunction mapping() { }); } + private void logIncomingRequest(ServerRequest request) { + var httpMethod = HttpMethod.POST.name(); + var type = request.headers().contentType().map(MediaType::toString).orElse("(unknown)"); + long contentLength = request.headers().contentLength().orElse(0L); + log.atDebug().log("{} /{} type: {} length: {}", httpMethod, endpoint, type, contentLength); + } + } diff --git a/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpOut.java b/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpOut.java index 528c0008e..8dad7c076 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpOut.java +++ b/ldi-orchestrator/ldio-connectors/ldio-http-out/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioHttpOut.java @@ -17,7 +17,7 @@ public class LdioHttpOut implements LdiOutput { - private static final Logger LOGGER = LoggerFactory.getLogger(LdioHttpOut.class); + private static final Logger log = LoggerFactory.getLogger(LdioHttpOut.class); private final RequestExecutor requestExecutor; private final String targetURL; @@ -39,9 +39,9 @@ public void accept(Model linkedDataModel) { final PostRequest request = new PostRequest(targetURL, new RequestHeaders(List.of(requestHeader)), content); Response response = requestExecutor.execute(request); if (response.isSuccess()) { - LOGGER.info(request.getMethod() + " " + request.getUrl() + " " + response.getHttpStatus()); + log.debug(request.getMethod() + " " + request.getUrl() + " " + response.getHttpStatus()); } else { - LOGGER.atError().log("Failed to post model. The request url was {}. " + + log.atError().log("Failed to post model. The request url was {}. " + "The http response obtained from the server has code {} and body \"{}\".", response.getRequestedUrl(), response.getHttpStatus(), response.getBody().orElse(null)); } diff --git a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java index 91488216d..5aeb21864 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java +++ b/ldi-orchestrator/ldio-connectors/ldio-kafka/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioKafkaIn.java @@ -6,10 +6,13 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.header.Header; import org.apache.kafka.common.header.Headers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.kafka.listener.MessageListener; public class LdioKafkaIn extends LdiInput implements MessageListener { + private static final Logger log = LoggerFactory.getLogger(LdioKafkaIn.class); private final String defaultContentType; /** @@ -30,8 +33,9 @@ public LdioKafkaIn(ComponentExecutor executor, LdiAdapter adapter, String defaul @Override public void onMessage(ConsumerRecord data) { final String contentType = determineContentType(data.headers()); - getAdapter().apply(LdiAdapter.Content.of(data.value(), contentType)) - .forEach(getExecutor()::transformLinkedData); + final var content = LdiAdapter.Content.of(data.value(), contentType); + log.atDebug().log("Incoming kafka message: {}", content); + getAdapter().apply(content).forEach(getExecutor()::transformLinkedData); } private String determineContentType(Headers headers) { diff --git a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java index a9540cccb..04301f993 100644 --- a/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java +++ b/ldi-orchestrator/ldio-connectors/ldio-ldes-client-connector/src/main/java/be/vlaanderen/informatievlaanderen/ldes/ldio/LdioLdesClientConnectorApi.java @@ -4,6 +4,7 @@ import be.vlaanderen.informatievlaanderen.ldes.ldi.requestexecutor.executor.edc.services.TransferService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.ServerRequest; @@ -46,9 +47,10 @@ public RouterFunction endpoints() { } private void logIncomingRequest(ServerRequest request) { + var httpMethod = HttpMethod.POST.name(); var type = request.headers().contentType().map(MediaType::toString).orElse("(unknown)"); long contentLength = request.headers().contentLength().orElse(0L); - log.atDebug().log("POST /%s type: %s length: %s".formatted(pipelineName, type, contentLength)); + log.atDebug().log("{} /{} type: {} length: {}", httpMethod, pipelineName, type, contentLength); } }