Skip to content

Commit 6e048d5

Browse files
committed
Fix: do not leak ThreadContext into the system
this is fairly recent - since 7.4 (added in GH-11075) there's a risk plugins would assume ThreadContext to exist or collide the 'global' constant - usually best to import where the Java class actually gets used ... Fixes #11356
1 parent 46f2618 commit 6e048d5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

logstash-core/lib/logstash/java_pipeline.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
require "logstash/compiler"
99
require "logstash/config/lir_serializer"
1010

11-
java_import org.apache.logging.log4j.ThreadContext
12-
1311
module LogStash; class JavaPipeline < JavaBasePipeline
1412
include LogStash::Util::Loggable
13+
14+
java_import org.apache.logging.log4j.ThreadContext
15+
1516
attr_reader \
1617
:worker_threads,
1718
:events_consumed,

logstash-core/lib/logstash/pipeline.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
require "logstash/filter_delegator"
1313
require "logstash/compiler"
1414

15-
java_import org.apache.logging.log4j.ThreadContext
16-
1715
module LogStash; class BasePipeline < AbstractPipeline
1816
include LogStash::Util::Loggable
1917

18+
java_import org.apache.logging.log4j.ThreadContext
19+
2020
attr_reader :inputs, :filters, :outputs
2121

2222
def initialize(pipeline_config, namespaced_metric = nil, agent = nil)

0 commit comments

Comments
 (0)