Last active
April 23, 2022 17:28
-
-
Save stdmitry/314cc42d6bd40900f691a8cf77a842af to your computer and use it in GitHub Desktop.
Java logging example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
public class Example2Controller { | |
private static final Logger log = LoggerFactory.getLogger(Example2Controller.class); | |
@GetMapping("/example2") | |
public Mono<String> example2() { | |
return doSomeStuff(); | |
} | |
private Mono<String> doSomeStuff() { | |
return | |
Mono.just("Some data") | |
.doOnEach(signal -> { | |
if (signal.isOnNext()) { | |
var requestId = (String) signal.getContextView().get("requestId"); | |
log.info("This is request id: {}", requestId); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment