File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
internal-logging/src/main/java/co/elastic/otel/logging Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2929import io .opentelemetry .sdk .trace .export .SimpleSpanProcessor ;
3030import io .opentelemetry .sdk .trace .export .SpanExporter ;
3131import java .util .Collection ;
32+ import java .util .List ;
3233import java .util .concurrent .atomic .AtomicBoolean ;
3334import org .apache .logging .log4j .Level ;
3435import org .apache .logging .log4j .core .config .Configurator ;
@@ -90,11 +91,11 @@ public static void addSpanLoggingIfRequired(
9091 // spans logging will be done by the explicitly configured logging exporter instance.
9192
9293 logPlainText = config .getBoolean (OTEL_JAVAAGENT_DEBUG , false );
93- String exporterName = logPlainText ? "logging" : "otlp-logging" ;
9494
95- boolean loggingExporterNotAlreadyConfigured =
96- !config .getList ("otel.traces.exporter" , emptyList ()).contains (exporterName );
97- if (loggingExporterNotAlreadyConfigured ) {
95+ List <String > configuredExporters = config .getList ("otel.traces.exporter" , emptyList ());
96+ boolean loggingConfigured =
97+ configuredExporters .stream ().anyMatch (e -> e .equals ("logging" ) || e .equals ("otlp-logging" ));
98+ if (!loggingConfigured ) {
9899 debugLogSpanExporter =
99100 new DebugLogSpanExporter (
100101 logPlainText ? LoggingSpanExporter .create () : OtlpJsonLoggingSpanExporter .create ());
You can’t perform that action at this time.
0 commit comments