When I start up the my spring boot application via intellij, the following class initialised properly and the log can be seen. but if I run agains the jar from the build, MyCurrentTraceContext seem not initialised and I can't see the log in the output either. I do need this class with my customised logic to run put of some argument into MDC. Any advice?
@Configuration
@ConditionalOnProperty(value="spring.sleuth.enabled", matchIfMissing=true)
@AutoConfigureBefore(TraceAutoConfiguration.class)
public class MyLogConfiguration extends SleuthLogAutoConfiguration {
private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(WtrLogConfiguration.class);
@Configuration
@ConditionalOnClass(MDC.class)
@EnableConfigurationProperties(SleuthSlf4jProperties.class)
protected static class MySlf4jConfiguration extends Slf4jConfiguration {
@Bean
@ConditionalOnProperty(value = "spring.sleuth.log.slf4j.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
@Override
public CurrentTraceContext slf4jSpanLogger() {
LOGGER.info("************ OVER WRITTING WTIH WtrCurrentTraceContext*******");
return new MyCurrentTraceContext(Slf4jCurrentTraceContext.create());
}
}
}