Search code examples
javaspringslf4jspring-cloud-sleuth

Add spring cloud sleuth to Spring application with Jetty server


I am trying to integrate spring cloud sleuth with an existing spring application which uses jetty server.

I have added

<dependencyManagement>
   <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth</artifactId>
            <version>1.2.4.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement> 

and

<dependencies>
   <dependency>spring-cloud-starter-sleuth</dependency>
</dependencies>

How should I pass the logger properties, logging pattern while starting the app? Right now, it does not read the properties file under /resources folder and no traceId or spanId is generated.

Most of the examples have used Spring Boot. Need help to figure out how to integrate this with a Spring application with jetty server.


Solution

  • For non Spring Boot applications please use https://github.com/openzipkin/brave . Spring Cloud Sleuth is Boot based.