Removed the - signs from default spring var resolution
with the current setup we're using the MDC's default interpolation as a default for spring var resolution (which makes no sense) with this change we're removing the dashes fixes gh-1396
This commit is contained in:
@@ -49,7 +49,7 @@ public class TraceEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
||||
if (Boolean
|
||||
.parseBoolean(environment.getProperty("spring.sleuth.enabled", "true"))) {
|
||||
map.put("logging.pattern.level", "%5p [${spring.zipkin.service.name:"
|
||||
+ "${spring.application.name:-}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]");
|
||||
+ "${spring.application.name:}},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]");
|
||||
}
|
||||
addOrReplace(environment.getPropertySources(), map);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,3 @@ logging.level.com.netflix.discovery: 'OFF'
|
||||
sample:
|
||||
zipkin:
|
||||
enabled: false
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: testSleuthFeign
|
||||
|
||||
@@ -16,10 +16,15 @@
|
||||
|
||||
package sample;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -28,8 +33,21 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@TestPropertySource(properties = "sample.zipkin.enabled=false")
|
||||
public class SampleFeignApplicationTests {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SampleFeignApplicationTests.class);
|
||||
|
||||
@Rule
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
// https://github.com/spring-cloud/spring-cloud-sleuth/issues/1396
|
||||
@Test
|
||||
public void should_not_pass_dash_as_default_service_name() {
|
||||
log.info("HELLO");
|
||||
|
||||
BDDAssertions.then(this.outputCapture.toString()).doesNotContain("INFO [-,,,]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user