From 9db3c5a2f7fe642dc954314d89a639130b0ea5d1 Mon Sep 17 00:00:00 2001
From: Phillip Webb <pwebb@vmware.com>
Date: Sun, 7 May 2023 22:55:07 -0700
Subject: [PATCH] Polish

---
 .../tracing/BraveAutoConfiguration.java             | 13 ++++++++-----
 .../src/docs/asciidoc/actuator/tracing.adoc         |  5 ++++-
 .../springframework/boot/logging/log4j2/log4j2.xml  |  2 +-
 .../spring-boot/src/test/resources/log4j2-test.xml  |  2 +-
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
index 43006e4e1fd8..a52d6167e196 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/BraveAutoConfiguration.java
@@ -29,7 +29,7 @@
 import brave.baggage.BaggagePropagation.FactoryBuilder;
 import brave.baggage.BaggagePropagationConfig;
 import brave.baggage.BaggagePropagationCustomizer;
-import brave.baggage.CorrelationScopeConfig;
+import brave.baggage.CorrelationScopeConfig.SingleCorrelationField;
 import brave.baggage.CorrelationScopeCustomizer;
 import brave.baggage.CorrelationScopeDecorator;
 import brave.context.slf4j.MDCScopeDecorator;
@@ -51,6 +51,7 @@
 import io.micrometer.tracing.exporter.SpanReporter;
 
 import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.actuate.autoconfigure.tracing.TracingProperties.Baggage.Correlation;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -225,11 +226,13 @@ CorrelationScopeDecorator.Builder mdcCorrelationScopeDecoratorBuilder(
 				matchIfMissing = true)
 		CorrelationScopeCustomizer correlationFieldsCorrelationScopeCustomizer() {
 			return (builder) -> {
-				List<String> correlationFields = this.tracingProperties.getBaggage().getCorrelation().getFields();
-				for (String field : correlationFields) {
-					builder.add(CorrelationScopeConfig.SingleCorrelationField.newBuilder(BaggageField.create(field))
+				Correlation correlationProperties = this.tracingProperties.getBaggage().getCorrelation();
+				for (String field : correlationProperties.getFields()) {
+					BaggageField baggageField = BaggageField.create(field);
+					SingleCorrelationField correlationField = SingleCorrelationField.newBuilder(baggageField)
 						.flushOnUpdate()
-						.build());
+						.build();
+					builder.add(correlationField);
 				}
 			};
 		}
diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc
index 5a1a1e418237..80e6305cd712 100644
--- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc
+++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/tracing.adoc
@@ -37,7 +37,10 @@ Add the following application properties:
 
 [source,yaml,indent=0,subs="verbatim",configprops,configblocks]
 ----
-	management.tracing.sampling.probability: 1.0
+	management:
+	  tracing:
+	    sampling:
+	      probability: 1.0
 ----
 
 By default, Spring Boot samples only 10% of requests to prevent overwhelming the trace backend.
diff --git a/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml b/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
index f70d01d28be4..5bcd7a322c4a 100644
--- a/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
+++ b/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
@@ -5,7 +5,7 @@
 		<Property name="LOG_LEVEL_PATTERN">%5p</Property>
 		<Property name="LOG_DATEFORMAT_PATTERN">yyyy-MM-dd'T'HH:mm:ss.SSSXXX</Property>
 		<Property name="CONSOLE_LOG_PATTERN">%clr{%d{${sys:LOG_DATEFORMAT_PATTERN}}}{faint} %clr{${sys:LOG_LEVEL_PATTERN}} %clr{%pid}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
-		<Property name="FILE_LOG_PATTERN">%d{${LOG_DATEFORMAT_PATTERN}} ${LOG_LEVEL_PATTERN} %pid --- [%t] %-40.40c{1.} : %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
+		<Property name="FILE_LOG_PATTERN">%d{${sys:LOG_DATEFORMAT_PATTERN}} ${sys:LOG_LEVEL_PATTERN} %pid --- [%t] %-40.40c{1.} : %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
 	</Properties>
 	<Appenders>
 		<Console name="Console" target="SYSTEM_OUT" follow="true">
diff --git a/spring-boot-project/spring-boot/src/test/resources/log4j2-test.xml b/spring-boot-project/spring-boot/src/test/resources/log4j2-test.xml
index 8c0f7f465254..66496afcd8af 100644
--- a/spring-boot-project/spring-boot/src/test/resources/log4j2-test.xml
+++ b/spring-boot-project/spring-boot/src/test/resources/log4j2-test.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="warn" name="test" packages="">
+<Configuration status="warn" name="test">
 	<Properties>
 		<Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property>
 		<Property name="LOG_LEVEL_PATTERN">%5p</Property>