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

💡 [Feature] Twitcher: Log WARN/ERROR level of gunicor/pyramid in docker logs twitcher #411

Open
tlvu opened this issue Dec 11, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@tlvu
Copy link
Collaborator

tlvu commented Dec 11, 2023

Description

When debugging Twitcher access error, even with DEBUG log level enabled for Twitcher, some access are still not available in docker logs twitcher because they are at gunicor/pyramid layer.

Example: When accessing http://twitcher:8000/twitcher/ows/proxy/... the access returns 404 not found but we do not see that access in docker logs twitcher. This could happen when the front Nginx proxy is badly configured when forwarding to the request to Twitcher because Twitcher listens at /ows/proxy/... and not /twitcher/ows/proxy/....

So enabling WARN/ERROR level of gunicor/pyramid in docker logs twitcher will solve that missing log and ease future debugging.

The file to enable the extra logging: https://github.com/bird-house/birdhouse-deploy/blob/master/birdhouse/components/twitcher/twitcher.ini.template

Should only enable WARN and ERROR level to avoid excessive logging.

References

Unable to change Twitcher logging level fixed in PR #410

@tlvu tlvu added the enhancement New feature or request label Dec 11, 2023
@fmigneault
Copy link
Collaborator

If the nginx config directly does the redirect, such as in

proxy_pass https://${PAVICS_FQDN}${TWITCHER_PROTECTED_PATH}/thredds/;
, and that the resolved endpoint is invalid for some reason, then nginx would be the one yielding 404. It would make sense that it is not visible, because you would need something like docker compose logs -f twitcher proxy to get both.

Once the proxy resolved to the correct Twitcher service, then gunicon/pyramid can be involved.
I would suggest adding relevant configs in the template:

[loggers]
keys = root, twitcher, magpie, sqlalchemy

change to keys = root, twitcher, magpie, sqlalchemy, gunicorn, pyramid

copy-paste and adjust the names:

[logger_sqlalchemy]
# "level = DEBUG" logs SQL queries, transactions and results
# "level = INFO" logs SQL queries (data can be identified from query field values)
# "level = WARN" logs neither (recommended for production systems, avoid anything below unless for dev/debug system)
level = WARN
handlers =
qualname = sqlalchemy.engine

ie: [logger_sqlalchemy] -> [logger_pyramid]andqualname = sqlalchemy.engine->qualname = pyramid`

You can use more granular nesting of packages (ie: qualname = sqlalchemy.engine) as deemed necessary.

By default, loggers should be in INFO.

[logger_root]
level = INFO
handlers = console

If pyramid and gunicorn do not respect that, it is probably because they override it themselves somewhere when doing the setup of their own package.

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

No branches or pull requests

2 participants