-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logbook doesn't work with spring boot 3 #1485
Comments
Hi @willlie1 |
Hello @evkaky @SpringBootApplication
public class LogbookWebClientApplication {
public static void main(String[] args) {
SpringApplication.run(LogbookWebClientApplication.class, args);
}
@Bean
Logbook logbook() {
return Logbook.create();
}
@Bean
public ApplicationRunner onStart(WebClient.Builder webClientBuilder, Logbook logbook) {
return args -> {
var webClient = webClientBuilder
.baseUrl("https://jsonplaceholder.typicode.com")
.filter(new LogbookExchangeFilterFunction(logbook))
.build();
Todo resp = webClient
.get()
.uri("todos/{id}", 1)
.retrieve()
.bodyToMono(Todo.class)
.block();
};
}
} At startup you should have logs for Outgoing and Incoming Response. |
For spring-webflux application you'd need to use But it looks like the org.springframework.boot.autoconfigure.AutoConfiguration.imports file is missing in |
The autoconfiguration part should be fixed in the next release. I'll resolve the issue. Feel free to reopen if you still need support here. |
Springboot 3.3.1 with logbook-spring-boot-start version 3.9.0 Thx |
In my Spring Boot WebFlux project, I am unable to generate any logs using Logbook. Here is the relevant section from my pom.xml:
The configuration in application.yml is as follows:
|
You've missed to post your logging (framework) configuration. |
Updated |
You configure Logbook to use the category (aka logger name) "category: logbook.log" but then you configure your logging framework to change the log level of "org.zalando". Those need to be aligned. You can just delete the line with "category" and then it should already work. (This has nothing to do with Logbook, technically. Just logging framework configuration.) |
I removed the category entirely, but I'm still not seeing any output. I also set write.level = INFO for both Logbook and the root logger, but nothing. |
The full category name is |
Could you provide some advice on how to debug this issue? Specifically, which important classes should I focus on, and where would be the best places to set breakpoints? |
DefaultStrategy and DefaultHttpLogWriter are good candidates. Both should
be triggering in the happy case. If they do, then your problem is outside
of Logbook.
…On Wed, Aug 28, 2024, 17:58 Fabio Trabattoni ***@***.***> wrote:
Could you provide some advice on how to debug this issue? Specifically,
which important classes should I focus on, and where would be the best
places to set breakpoints?
—
Reply to this email directly, view it on GitHub
<#1485 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADI7HOMG2IC5FOTEKQHYUDZTXXTTAVCNFSM6AAAAABMWOGGYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJVG4ZTQNBRGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Turns out it works when trace is enabled. It is not picking up this setting:
|
Could it be that this feature was removed at some point?
…On Thu, Aug 29, 2024, 10:26 Fabio Trabattoni ***@***.***> wrote:
DefaultHttpLogWriter
Turns out it works when trace is enabled. It is not picking up this
setting:
write:
level: DEBUG
—
Reply to this email directly, view it on GitHub
<#1485 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADI7HIVFI3XEURTMAT3BJLZT3LK3AVCNFSM6AAAAABMWOGGYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJXGAYDQMBSGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I am sure it was. I mean, I hope it was just moved somewhere else. |
I'm following the documentation https://github.com/zalando/logbook#spring-boot-starter trying to make
WebClient
logging all exchanges, but here is a minimal code sample to make sure logbook + spring boot web client = nothing get loggedbuild.gradle.kts
:src/main/resources/application.yml
:SpringApplication.java
:![image](https://user-images.githubusercontent.com/4532181/232755065-b005dbb3-4103-4834-955e-c642b2bc7b0a.png)
As you can see, nothing got loggedThe text was updated successfully, but these errors were encountered: