From 9c1c926941bf05b79e3be582bdda2e983b61ba4d Mon Sep 17 00:00:00 2001 From: Randal Kamradt Date: Sat, 16 May 2020 05:50:49 -0700 Subject: [PATCH] tweak controller and logging --- pom.xml | 13 +++++++++++++ .../readnews/ReadHeadlinesControllerV1.java | 2 ++ src/main/resources/logback-spring.xml | 15 +++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 src/main/resources/logback-spring.xml diff --git a/pom.xml b/pom.xml index e67596c..b536f6f 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,19 @@ org.springframework spring-web + + org.slf4j + slf4j-api + + + net.logstash.logback + logstash-logback-encoder + 6.3 + + + ch.qos.logback + logback-classic + org.projectlombok lombok diff --git a/src/main/java/net/kamradtfamily/readnews/ReadHeadlinesControllerV1.java b/src/main/java/net/kamradtfamily/readnews/ReadHeadlinesControllerV1.java index 8836254..42565a4 100644 --- a/src/main/java/net/kamradtfamily/readnews/ReadHeadlinesControllerV1.java +++ b/src/main/java/net/kamradtfamily/readnews/ReadHeadlinesControllerV1.java @@ -52,10 +52,12 @@ Flux getFromMongo(final Instant from, final Instant to, final long actualLimit = limit == null || limit == 0 || limit > MAX_LIMIT ? MAX_LIMIT : limit; + log.info("returning news with " + actualLimit); return newsReactiveRepository .findAll() .flatMap(r -> Flux.fromIterable(r.getArticles())) .filter(r -> filterByDate(r, from, to)) + .doFinally((type) -> log.info("returned news with limit " + actualLimit + " type " + type)) .limitRequest(actualLimit); } diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..69f152e --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,15 @@ + + + + + + + 10000 + true + + + + + + +