Skip to content
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

I can not find logs in console using spring boot app, I have just installed logbook-spring-boot-starter and add logging.level.org.zalando.logbook.Logbook=TRACE to my common.properties file #768

Closed
Doaa82 opened this issue Jun 18, 2020 · 4 comments
Labels

Comments

@Doaa82
Copy link

Doaa82 commented Jun 18, 2020

Description

When I Installed the maven dependency and the logbook level tp TRACE, When I hit any endpoint in the application

Expected Behavior

I am expecting the request and the response to be logged in the console

Actual Behavior

I got nothing log in the console

Possible Fix

Steps to Reproduce

Context

Your Environment

  • Version used:
  • Link to your project:
@Doaa82 Doaa82 added the Bug label Jun 18, 2020
@whiskeysierra
Copy link
Collaborator

whiskeysierra commented Jun 18, 2020 via email

@Doaa82
Copy link
Author

Doaa82 commented Jun 20, 2020

@whiskeysierra yes I will prepare a sample application and share it, but as a clarification could you please confirm the following:

  1. in order to enable logging with logbook and spring boot, I need only to install logbook-spring-boot-starter dependency and set this configuration logging.level.org.zalando.logbook.Logbook=TRACE. [Please confirm]
  2. if we do not need any extra customization, then the above two configurations in step Correlate request and response #1 are enough to see logs in the console. [Please confirm]
  3. Any endpoint defined in a class annotated with @Controller should be automatically logged in the console when executing the endpoint through postman. [Please confirm]
  4. Please advise if the logs will be in a different place than console, so I can check.
  5. Could you please advise and guide me to a real working example since I followed the steps in RAEDME but I still do not know what is missing so that log is not displayed in the console, is there any specific instructions or setup that I should apply? [Please advise]

@whiskeysierra
Copy link
Collaborator

whiskeysierra commented Jun 22, 2020

  1. in order to enable logging with logbook and spring boot, I need only to install logbook-spring-boot-starter dependency

Correct.

and set this configuration logging.level.org.zalando.logbook.Logbook=TRACE

Logbook makes no hard requirement about the logging framework or how you configure it. I haven't used Spring's logging configuration personally yet, but that looks good to me.

  1. if we do not need any extra customization, then the above two configurations in step Correlate request and response #1 are enough to see logs in the console.

Whether something is logged to the console or a file depends on your logging framework and your configuration. I can't tell, really. Logbook's responsibility ends at the SLF4J level. Logbook's contract is as follows: It uses the org.logbook.Logbook logger with the level TRACE by default. It's up to the user to make sure the logging framework is setup correctly and that the particular logger is in fact active and connected to an appender.

  1. Any endpoint defined in a class annotated with @Controller should be automatically logged in the console when executing the endpoint through postman.

Confirmed.

  1. Please advise if the logs will be in a different place than console, so I can check.

See points above. The configuration of your logging framework is out of scope for Logbook.

  1. Could you please advise and guide me to a real working example since I followed the steps in RAEDME but I still do not know what is missing so that log is not displayed in the console, is there any specific instructions or setup that I should apply?

Your setup sounds good to me. It should work. The only thing I can offer is to take a look at an example. Once we get your example working, I'd be more than happy to incorporate it into logbook for future users.

@whiskeysierra
Copy link
Collaborator

@Doaa82 Feel free to create a sample project or a test to verify the behavior that you see. I'm more than happy to reopen this, if needed, but for the time being I don't think there is anything to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants