Set the logging context on the PatternLayout

This commit is contained in:
Chris Eager
2026-01-05 10:31:40 -06:00
committed by Chris Eager
parent e1c44dd374
commit 54443f7015

View File

@@ -101,6 +101,7 @@ public class LogstashTcpSocketAppenderFactory extends AbstractAppenderFactory<IL
final LayoutWrappingEncoder<ILoggingEvent> prefix = new LayoutWrappingEncoder<>();
final PatternLayout layout = new PatternLayout();
layout.setPattern(String.format("%s ", apiKey.value()));
layout.setContext(context);
prefix.setLayout(layout);
encoder.setPrefix(prefix);
appender.setEncoder(encoder);