From 1c2b1f3df7336ceca4bba04f0aebecbae59b1d6d Mon Sep 17 00:00:00 2001 From: Caesar Ralf Date: Mon, 10 Jul 2023 11:14:40 +0200 Subject: [PATCH 1/3] Update encoder to latest version --- pom.xml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 46817eb..f1bb36f 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,18 @@ + + + + com.fasterxml.jackson + jackson-bom + 2.15.2 + pom + import + + + + @@ -66,7 +78,7 @@ net.logstash.logback logstash-logback-encoder - 4.11 + 7.4 @@ -111,7 +123,6 @@ com.fasterxml.jackson.core jackson-databind - 2.12.7.1 test From 05ce168daccda2525365705f84871e2ef079c1b7 Mon Sep 17 00:00:00 2001 From: Caesar Ralf Date: Mon, 10 Jul 2023 11:18:36 +0200 Subject: [PATCH 2/3] Update jewelcli --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f1bb36f..7c3e3c3 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ uk.co.flamingpenguin.jewelcli jewelcli - 0.6 + 0.59 io.sentry From 71c0ab3c1c527e7b194131df9ad84b256fa6c6a5 Mon Sep 17 00:00:00 2001 From: Caesar Ralf Date: Mon, 10 Jul 2023 11:26:30 +0200 Subject: [PATCH 3/3] Remove guava dependency --- pom.xml | 6 ------ .../logging/LoggingConfiguratorTest.java | 7 +++---- .../logging/logback/LogstashEncoderTest.java | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 7c3e3c3..fd5df5f 100644 --- a/pom.xml +++ b/pom.xml @@ -125,12 +125,6 @@ jackson-databind test - - com.google.guava - guava - 17.0 - test - diff --git a/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java b/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java index 3674f25..795c5b9 100644 --- a/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java +++ b/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java @@ -49,7 +49,6 @@ import ch.qos.logback.classic.net.SyslogAppender; import ch.qos.logback.core.ConsoleAppender; import ch.qos.logback.core.status.Status; -import com.google.common.collect.FluentIterable; import com.spotify.logging.logback.CustomLogstashEncoder; import io.sentry.logback.SentryAppender; import net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider; @@ -214,9 +213,9 @@ private void assertLogstashEncoder(final Level level) { final CustomLogstashEncoder encoder = (CustomLogstashEncoder) stdout.getEncoder(); assertEquals( 1, - FluentIterable.from(encoder.getProviders().getProviders()) - .filter(ArgumentsJsonProvider.class) - .size()); + encoder.getProviders().getProviders().stream() + .filter(ArgumentsJsonProvider.class::isInstance) + .count()); } private void assertDefault(final String ident, final Level level) { diff --git a/src/test/java/com/spotify/logging/logback/LogstashEncoderTest.java b/src/test/java/com/spotify/logging/logback/LogstashEncoderTest.java index 83ac6cc..cbd9ddf 100644 --- a/src/test/java/com/spotify/logging/logback/LogstashEncoderTest.java +++ b/src/test/java/com/spotify/logging/logback/LogstashEncoderTest.java @@ -26,10 +26,11 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.spotify.logging.LoggingConfigurator; import com.spotify.logging.LoggingConfigurator.Level; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import net.logstash.logback.encoder.LogstashEncoder; import org.junit.Rule; import org.junit.Test; @@ -52,8 +53,8 @@ public void shouldIncludeStructuredArguments() throws JsonProcessingException { "foo={} bar={} list={} map={} thing={}", value("foo", 17), value("bar", "quux"), - value("list", ImmutableList.of(1, 2)), - value("map", ImmutableMap.of("a", 3, "b", 4)), + value("list", Arrays.asList(1, 2)), + value("map", mapOf("a", 3, "b", 4)), value("thing", new Thing(5, "6"))); final String log = systemOutRule.getLog(); final JsonNode parsedMessage = mapper.readTree(log); @@ -67,6 +68,14 @@ public void shouldIncludeStructuredArguments() throws JsonProcessingException { assertEquals(mapper.createObjectNode().put("v1", 5).put("v2", "6"), parsedMessage.get("thing")); } + private Map mapOf( + final String keyA, final V valueA, final String keyB, final V valueB) { + final Map map = new HashMap<>(); + map.put(keyA, valueA); + map.put(keyB, valueB); + return map; + } + public static class Thing { private final int v1;