javaspringspring-bootlogginghystrix

Override Hysterix Logging


I am trying to understand the logs generated by SpringBoot before and after implementing Hysterix Circuit Breaker

Before Hystrix the logs looked like,

17:31:35.977 [http-nio-8080-exec-2] [TransID:bcc8a9e9-41b7-47c8-9eb1-0f8becb42f68] INFO  c.f.e.common.logging.MethodLogging - Entered Class: class com.org.myapp.service.MyService, Method: getData, Arguments: 123456

After implementing Hystrix the logs looks like,

17:21:23.197 [hystrix-MyController-1] [TransID:] INFO  c.f.e.common.logging.MethodLogging - Entered Class: class com.org.myapp.service.MyService, Method: getData, Arguments: 123456

So, how did http-nio-8080-exec-2 get replaced with hystrix-OrchestratorController-1, and why it's not showing my TransactionId when Hystrix got implemented. How did Hystrix take over the logging? What's the difference between both? Is there any way to revert back to my old logging format? I tried hystrix.command.default.requestLog.enabled=false in my application.properties, but no luck.

Main class

@SpringBootApplication
@EnableCircuitBreaker
class MyApp{
}

RestController

@GetMapping("...")
@HystrixCommand(commandKey="data")
public Object getData(){
}

application.properties

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=5000

Solution

  • Hystrix is using its own thread instead of the local thread. That's the reason your log looks different.

    Add this property in your application.properties

    hystrix.command.default.execution.isolation.strategy=SEMAPHORE
    

    Now hystrix will use your local thread.