Skip to content

Commit

Permalink
Support for logback-access 2.0.0 (#1015)
Browse files Browse the repository at this point in the history
* Support for logback-access 2.0.x

* Bump version to 8.0-SNAPSHOT

Remove servlet-api test dependency

---------

Co-authored-by: Phil Clay <philsttr@users.noreply.github.com>
  • Loading branch information
sondemar and philsttr authored Jul 27, 2024
1 parent 78cf15c commit b4ab2e6
Show file tree
Hide file tree
Showing 51 changed files with 89 additions and 93 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ you may request to become a maintainer by filing an issue.
Build from Source
-----------------

JDK 8 is required to build from source.
JDK 11 is required to build from source.

Use `mvnw` (\*nix) or `mvnw.cmd` (windows) to build.

Expand Down
42 changes: 18 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>7.5-SNAPSHOT</version>
<version>8.0-SNAPSHOT</version>

<name>Logstash Logback Encoder</name>
<description>Provides logback encoders, layouts, and appenders to log in JSON and other formats supported by Jackson</description>
Expand All @@ -19,21 +19,21 @@
</scm>

<properties>
<java.version>8</java.version>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- runtime dependencies -->
<jackson.version>2.15.2</jackson.version>
<java-uuid-generator.version>4.2.0</java-uuid-generator.version>
<logback.version>1.3.7</logback.version>
<logback-core.version>1.5.6</logback-core.version>
<logback-access.version>2.0.2</logback-access.version>

<!-- shaded runtime dependencies -->
<disruptor.version>3.4.4</disruptor.version>

<!-- test dependencies -->
<assertj.version>3.24.2</assertj.version>
<awaitility.version>4.2.0</awaitility.version>
<servlet-api.version>4.0.1</servlet-api.version>
<junit.version>5.9.2</junit.version>
<mockito.version>5.1.1</mockito.version>

Expand Down Expand Up @@ -134,27 +134,17 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<version>${logback-core.version}</version>
<!--
Required for logging regular ILoggingEvents with a Logger.
Not needed if only logging IAccessEvents for access logs.
-->
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>${logback.version}</version>
<!--
Required for logging IAccessEvents for access logs.
Not needed if only logging regular ILoggingEvents with a Logger.
-->
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
<version>${logback-core.version}</version>
<!--
"provided" since users of logstash-logback-encoder must also
directly depend on logback-classic or logback-access,
Expand All @@ -163,10 +153,14 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>test</scope>
<groupId>ch.qos.logback.access</groupId>
<artifactId>common</artifactId>
<version>${logback-access.version}</version>
<!--
Required for logging IAccessEvents for access logs.
Not needed if only logging regular ILoggingEvents with a Logger.
-->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down Expand Up @@ -274,7 +268,7 @@
higher than the minimum JDK version we support.
-->
<enforceBytecodeVersion>
<maxJdkVersion>1.8</maxJdkVersion>
<maxJdkVersion>11</maxJdkVersion>
<ignoreClasses>
<ignoreClass>META-INF/versions/*</ignoreClass>
</ignoreClasses>
Expand Down Expand Up @@ -534,9 +528,9 @@
<!-- Setup links to external api docs
-->
<links>
<link>https://javadoc.io/doc/ch.qos.logback/logback-core/${logback.version}</link>
<link>https://javadoc.io/doc/ch.qos.logback/logback-classic/${logback.version}</link>
<link>https://javadoc.io/doc/ch.qos.logback/logback-access/${logback.version}</link>
<link>https://javadoc.io/doc/ch.qos.logback/logback-core/${logback-core.version}</link>
<link>https://javadoc.io/doc/ch.qos.logback/logback-classic/${logback-core.version}</link>
<link>https://javadoc.io/doc/ch.qos.logback.access/common/${logback-access.version}</link>

<link>https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/${jackson.version}</link>
<link>https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/${jackson.version}</link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import net.logstash.logback.composite.accessevent.StatusCodeJsonProvider;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.joran.spi.DefaultClass;
import ch.qos.logback.core.spi.ContextAware;
import com.fasterxml.jackson.databind.JsonNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import net.logstash.logback.appender.listener.AppenderListener;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;

/**
* A {@link DelegatingAsyncDisruptorAppender} for {@link IAccessEvent}s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import net.logstash.logback.appender.listener.AppenderListener;
import net.logstash.logback.status.LevelFilteringStatusListener;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.AsyncAppender;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import net.logstash.logback.appender.listener.AppenderListener;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.AsyncAppenderBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import net.logstash.logback.appender.listener.TcpAppenderListener;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;

/**
* A {@link AbstractLogstashTcpSocketAppender} for logging {@link IAccessEvent}s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package net.logstash.logback.appender;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.Layout;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package net.logstash.logback.appender.listener;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.Appender;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.net.InetSocketAddress;
import java.net.Socket;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.Appender;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import net.logstash.logback.util.SimpleObjectJsonGeneratorDelegate;
import net.logstash.logback.util.ThreadLocalHolder;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.spi.ContextAware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package net.logstash.logback.composite;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.DeferredProcessingAware;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package net.logstash.logback.composite;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.ContextAwareBase;
import ch.qos.logback.core.spi.DeferredProcessingAware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;
import java.util.Objects;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.DeferredProcessingAware;
import com.fasterxml.jackson.core.JsonFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.pattern.AbstractJsonPatternParser.JsonPatternException;
import net.logstash.logback.pattern.NodeWriter;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.DeferredProcessingAware;
import com.fasterxml.jackson.core.JsonFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import net.logstash.logback.fieldnames.LogstashCommonFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.spi.DeferredProcessingAware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.io.IOException;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.ContextAware;
import ch.qos.logback.core.spi.DeferredProcessingAware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Collections;
import java.util.List;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.spi.DeferredProcessingAware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import net.logstash.logback.fieldnames.LogstashCommonFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.DeferredProcessingAware;
import com.fasterxml.jackson.core.JsonGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.logstash.logback.composite.AbstractCompositeJsonFormatter;
import net.logstash.logback.composite.JsonProviders;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.joran.spi.DefaultClass;
import ch.qos.logback.core.spi.ContextAware;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import net.logstash.logback.composite.AbstractFormattedTimestampJsonProvider;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;

public class AccessEventFormattedTimestampJsonProvider extends AbstractFormattedTimestampJsonProvider<IAccessEvent, LogstashAccessFieldNames> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import net.logstash.logback.composite.JsonProviders;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;

/**
* Used to make it make it more convenient to create well-known
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.logstash.logback.composite.AbstractNestedJsonProvider;
import net.logstash.logback.composite.JsonProviders;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.joran.spi.DefaultClass;

public class AccessEventNestedJsonProvider extends
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import net.logstash.logback.pattern.AbstractJsonPatternParser;
import net.logstash.logback.pattern.AccessEventJsonPatternParser;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonFactory;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.logstash.logback.composite.AbstractThreadNameJsonProvider;
import net.logstash.logback.composite.JsonProvider;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;

/**
* {@link JsonProvider} producing a single JSON field with the {@link IAccessEvent#getThreadName()}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import net.logstash.logback.composite.loggingevent.MessageJsonProvider;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class AccessMessageJsonProvider extends AccessEventFormattedTimestampJsonProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class ContentLengthJsonProvider extends AbstractFieldJsonProvider<IAccessEvent> implements FieldNamesAware<LogstashAccessFieldNames> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class ElapsedTimeJsonProvider extends AbstractFieldJsonProvider<IAccessEvent> implements FieldNamesAware<LogstashAccessFieldNames> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class MethodJsonProvider extends AbstractFieldJsonProvider<IAccessEvent> implements FieldNamesAware<LogstashAccessFieldNames> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class ProtocolJsonProvider extends AbstractFieldJsonProvider<IAccessEvent> implements FieldNamesAware<LogstashAccessFieldNames> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class RemoteHostJsonProvider extends AbstractFieldJsonProvider<IAccessEvent> implements FieldNamesAware<LogstashAccessFieldNames> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import com.fasterxml.jackson.core.JsonGenerator;

public class RemoteUserJsonProvider extends AbstractFieldJsonProvider<IAccessEvent> implements FieldNamesAware<LogstashAccessFieldNames> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import net.logstash.logback.composite.JsonWritingUtils;
import net.logstash.logback.fieldnames.LogstashAccessFieldNames;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.common.spi.IAccessEvent;
import ch.qos.logback.core.joran.spi.DefaultClass;
import com.fasterxml.jackson.core.JsonGenerator;

Expand Down
Loading

0 comments on commit b4ab2e6

Please sign in to comment.