-
Notifications
You must be signed in to change notification settings - Fork 7
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
Increase log level of root logger #145
Conversation
`ops` adds juju debug-log handler to root logger—meaning all Python dependencies log to juju debug-log lightkube's DEBUG and INFO level logs are particularlly noisy and clutter up the debug log Set root level logger to WARNING and only send DEBUG and INFO level logs to juju debug-log if the log is in the charm code
# Set root logger level | ||
logging.getLogger().setLevel(logging.WARNING) | ||
# Set charm logger level | ||
logging.getLogger("router_charm").setLevel(logging.DEBUG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this are you setting the router log level to ignore the model log level and always be on DEBUG
?
If the idea is to quiet down lightkube related logs, there's another approach here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the model level filters the debug log
ops already always sends all DEBUG level logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to let the router logs be default, and only set the log level for the lightkube logs as paulo suggested? if so, i definitely prefer that approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's possible
do we want our all python deps to have debug level logs? to me it seems like we should raise the log level for all our python deps, instead of individually adding noisy deps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: do we want our all python deps to have debug level logs
IMHO, no (by default).
Still, sometimes we need debug libraries (e.g. lightkube), can we use:
juju model-config -m foo logging-config="unit.mysql.lightkube/0=DEBUG"
to change verbosity for the specific library (from here)?
P.S. most-probably we should work with Juju team to provide such a capability for charm dependencies troubleshooting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't use model-config to change the verbosity for the library, but we can change the Python code
given that you believe the default should be to not debug packages (i.e. default is not to collect debug logs for packages) then it seems okay to change the code to enable debugging for packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fields never run charms with debug level (c) @phvalguima + charms should produce minimal amount of noise by default => default should be to not debug packages.
When user/developer need to debug complex application, he should be able to enable ALL debug messages and FILTER out necessary only (charm.py, dependency lib, maybe networking only in charm.py in the future). We are interested in a great debug experience... :-D
I have a strange feeling that we are not on the same page, happy to discuss this on sync! And tnx for taking care here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is infinite storage available for debug messages? in this particular case, lightkube's debug messages are taking a significant amount of space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we agree on keep these noisy packages with a Warning
log level?
It should de-clutter it without preventing important messages to pop.
`httpx` and `httpcore` (used by `lightkube`) have noisy INFO & DEBUG level logs Supersedes #145. It still seems a bit backwards to me to enable DEBUG level logs for all python dependencies and then manually disable logging for dependencies of our dependencies. Personally, I only think DEBUG level logs are useful for charm ecosystem code (e.g. ops, the charm, charm libs)—but it seems like the consensus [from this discussion](#145 (comment)) is different
Close this one then? |
Superseded by #176 |
ops
adds juju debug-log handler to root logger—meaning all Python dependencies log to juju debug-loglightkube's DEBUG and INFO level logs are particularly noisy and clutter up the debug log
Set root level logger to WARNING and only send DEBUG and INFO level logs to juju debug-log if the log is in the charm code