Skip to content

Commit b25048c

Browse files
authored
Merge pull request #465 from logstash/remove_logback_1_1_support
Remove support for logback 1.1
2 parents 34b4d28 + 561db6d commit b25048c

File tree

8 files changed

+43
-674
lines changed

8 files changed

+43
-674
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,20 @@ Maven style:
8686
</dependency>
8787
```
8888

89-
If you get `ClassNotFoundException`/`NoClassDefFoundError`/`NoSuchMethodError` at runtime, then ensure the required dependencies (and appropriate versions) as specified in the pom file from the maven repository exist on the runtime classpath. Specifically, the following need to be available on the runtime classpath:
89+
If you get `ClassNotFoundException`/`NoClassDefFoundError`/`NoSuchMethodError` at runtime,
90+
then ensure the required dependencies (and appropriate versions) as specified in the pom file
91+
from the maven repository exist on the runtime classpath.
92+
Specifically, the following need to be available on the runtime classpath:
9093

9194
* jackson-databind / jackson-core / jackson-annotations
92-
* logback-core
93-
* logback-classic (required for logging _LoggingEvents_)
94-
* logback-access (required for logging _AccessEvents_)
95+
* logback-core >= 1.2.0
96+
* logback-classic >= 1.2.0 (required for logging _LoggingEvents_)
97+
* logback-access >= 1.2.0 (required for logging _AccessEvents_)
9598
* slf4j-api
9699
* java-uuid-generator (required if the `uuid` provider is used)
97100

98101
Older versions than the ones specified in the pom file _might_ work, but the versions in the pom file are what testing has been performed against.
102+
Support for logback versions prior to 1.2.0 was removed in logstash-logback-encoder 7.0.
99103

100104
If you are using logstash-logback-encoder in a project (such as spring-boot) that also declares dependencies on any of the above libraries, you might need to tell maven explicitly which versions to use to avoid conflicts.
101105
You can do so using maven's [dependencyManagement](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management) feature.

src/main/java/net/logstash/logback/Logback11Support.java

Lines changed: 0 additions & 166 deletions
This file was deleted.

src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import javax.net.ssl.SSLSocket;
4343
import javax.net.ssl.SSLSocketFactory;
4444

45-
import net.logstash.logback.Logback11Support;
4645
import net.logstash.logback.appender.destination.DelegateDestinationConnectionStrategy;
4746
import net.logstash.logback.appender.destination.DestinationConnectionStrategy;
4847
import net.logstash.logback.appender.destination.DestinationParser;
@@ -595,11 +594,7 @@ private void writeEvent(Socket socket, OutputStream outputStream, LogEvent<Event
595594
* This is a standard (non-keepAlive) event.
596595
* Therefore, we need to send the event.
597596
*/
598-
if (getLogback11Support().isLogback11OrBefore()) {
599-
getLogback11Support().doEncode(encoder, logEvent.event);
600-
} else {
601-
outputStream.write(encoder.encode(logEvent.event));
602-
}
597+
outputStream.write(encoder.encode(logEvent.event));
603598
} else if (hasKeepAliveDurationElapsed(lastSendEndNanoTime, startNanoTime)){
604599
/*
605600
* This is a keep alive event, and the keepAliveDuration has passed,
@@ -731,10 +726,6 @@ private synchronized void openSocket() {
731726
? new BufferedOutputStream(tempSocket.getOutputStream(), writeBufferSize)
732727
: tempSocket.getOutputStream();
733728

734-
if (getLogback11Support().isLogback11OrBefore()) {
735-
getLogback11Support().init(encoder, tempOutputStream);
736-
}
737-
738729
addInfo(peerId + "connection established.");
739730

740731
this.socket = tempSocket;
@@ -798,14 +789,6 @@ private synchronized void closeSocket() {
798789
}
799790

800791
private void closeEncoder() {
801-
if (getLogback11Support().isLogback11OrBefore()) {
802-
try {
803-
getLogback11Support().close(encoder);
804-
} catch (IOException ioe) {
805-
addError("Failed to close encoder", ioe);
806-
}
807-
}
808-
809792
encoder.stop();
810793
}
811794

@@ -1057,13 +1040,6 @@ protected void fireConnectionFailed(InetSocketAddress address, Throwable throwab
10571040
}
10581041

10591042

1060-
/*
1061-
* Visible for unit testing
1062-
*/
1063-
protected Logback11Support getLogback11Support() {
1064-
return Logback11Support.INSTANCE;
1065-
}
1066-
10671043
public Encoder<Event> getEncoder() {
10681044
return encoder;
10691045
}

0 commit comments

Comments
 (0)