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

use connexion logger instead of root logger #2010

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

FelixSchwarz
Copy link
Contributor

In request_validation.py and response_validation.py there is a call to logging.info() which means the log message goes through the root logger instead of the connexion.middleware.validation logger.

@FelixSchwarz
Copy link
Contributor Author

Btw: Maybe it would be good to downgrade the log level for the message. I think this is more a debug message. Not having a validator is a static condition (either the dev configured the validator or not) so the log message is pretty useless in production. My personal rule of thumb is that something which is not relevant at all in the normal mode of operation should have a log level below INFO.

@coveralls
Copy link

Coverage Status

coverage: 94.408%. remained the same
when pulling 88a1d41 on FelixSchwarz:validation-root-logger
into 58c8bb6 on spec-first:main.

Copy link
Contributor

@chrisinmtown chrisinmtown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! That's an easy one to miss, logging doesn't complain about direct use of the root logger. I didn't know you could just call logging.info like that.

Copy link
Member

@RobbeSneyders RobbeSneyders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @FelixSchwarz!

Not sure about the logging level. It depends on the content type of the incoming request, so it is not completely static. I would argue that validation is one of the main features of Connexion, so silently bypassing it is also no ideal.

@RobbeSneyders RobbeSneyders merged commit 0a50bbb into spec-first:main Dec 4, 2024
8 checks passed
@FelixSchwarz FelixSchwarz deleted the validation-root-logger branch December 4, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants