Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions logstash-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ String jacksonVersion = versionMap['jackson']
String jacksonDatabindVersion = versionMap['jackson-databind']
String jrubyVersion = versionMap['jruby']['version']

String log4jVersion = '2.17.2'
String log4jVersion = '2.25.3'

// Specifically call use of PluginProcessor to skip GraalVmProcessor (not needed)
tasks.named('compileJava') {
options.compilerArgs.addAll([
"-processor", "org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor"
])
}

tasks.register("sourcesJar", Jar) {
dependsOn classes
Expand Down Expand Up @@ -242,7 +249,7 @@ dependencies {
exclude group: 'com.google.guava', module: 'guava'
}
implementation 'org.javassist:javassist:3.30.2-GA'
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}:tests"
testImplementation "org.apache.logging.log4j:log4j-core-test:${log4jVersion}"
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'junit:junit:4.13.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public String getFormattedMessage() {
return formatted;
}

@SuppressWarnings("deprecation")
@Override
public String getFormat() {
return null;
Expand Down
17 changes: 12 additions & 5 deletions logstash-core/src/test/java/org/logstash/ObjectMappersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,22 @@ public void testLog4jOMRegisterRubyBasicObjectSerializersFirst() {
list.add(serializer);
}

// RubyBasicObjectSerializer + Log4jJsonModule
// RubyBasicObjectSerializer + Log4jJsonModule + potentially other modules
assertTrue(list.size() > 1);

final Serializers rubyBasicObjectSerializer = list.get(list.size() - 2);
// Find the RubyBasicObjectSerializer among the registered serializers
final JavaType valueType = TypeFactory.defaultInstance().constructType(RubyBasicObject.class);
final JsonSerializer<?> found = rubyBasicObjectSerializer.findSerializer(mapper.getSerializationConfig(), valueType, null);
JsonSerializer<?> found = null;
for (Serializers serializer : list) {
JsonSerializer<?> candidate = serializer.findSerializer(mapper.getSerializationConfig(), valueType, null);
if (candidate instanceof RubyBasicObjectSerializer) {
found = candidate;
break;
}
}

assertNotNull(found);
assertTrue("RubyBasicObjectSerializer must be registered before others non-default serializers", found instanceof RubyBasicObjectSerializer);
assertNotNull("RubyBasicObjectSerializer must be registered", found);
assertTrue("RubyBasicObjectSerializer must be registered", found instanceof RubyBasicObjectSerializer);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import java.util.stream.IntStream;
import javax.annotation.concurrent.NotThreadSafe;

import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.assertj.core.api.Assertions;
import org.jruby.RubySystemExit;
import org.jruby.exceptions.RaiseException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.fasterxml.jackson.core.StreamReadConstraints;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext;
import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.jruby.RubyHash;
import org.jruby.runtime.builtin.IRubyObject;
import org.junit.After;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.logging.log4j.core.config.Configuration;

import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.junit.*;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.AppenderControl;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
import org.apache.logging.log4j.message.StructuredDataMessage;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -38,6 +38,7 @@ public void tearDown() {
this.loggerContextRule.getLoggerContext().stop();
}

@SuppressWarnings("deprecation")
@Test
public void routingTest() {
final String pipelineId = "test_pipeline";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package org.logstash.settings;

import co.elastic.logstash.api.Password;
import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.test.appender.ListAppender;
import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
import org.apache.logging.log4j.core.test.appender.ListAppender;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down
12 changes: 7 additions & 5 deletions qa/rspec/commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ def exit_status
end

def execute(cmdline)
Open3.popen3(cmdline) do |stdin, stdout, stderr, wait_thr|
@stdout = stdout.read.chomp
@stderr = stderr.read.chomp
@exit_status = wait_thr.value.exitstatus
end
# use of capture3 gives us strings instead of raw io objects
# this helps not having to deal with IO streams being full
# and requiring multi threaded reading to prevent tests being blocked
@stdout, @stderr, status = Open3.capture3(cmdline)
@stdout.chomp!
@stderr.chomp!
@exit_status = status.exitstatus
end
end

Expand Down