logging: enhanced log level setting interface#16021
Conversation
joestringer
left a comment
There was a problem hiding this comment.
Thanks for the submission. At a high level, this PR proposes to "enhance" the logging logic but I couldn't figure out what the enhancement is. I noticed a couple of log messages which are converted over to structured logging which is a nice cleanup, and there's a bunch of other churn which I honestly didn't follow.
What exactly is being enhanced here?
Couple of other minor comments to fix up below.
|
^ I should maybe add, the new code does seem a bit simpler at a glance. If that's the goal then I think I follow. If there's other bits I'm missing, please mention them since I wasn't able to pick them out from a brief glance through the PR ;) |
|
@joestringer This PR makes sense to me. The function logging.ConfigureLogLevel(false) // Use 'true' for debugging |
ae4c93b to
4bdca22
Compare
|
@joestringer, yes indeed, apologies for the vague description 🙇! I reckon that as you and @rolinh highlighted it is pretty much about having a At first it emerged from a bug which I found regarding the non interpretation of the I have incorporated your couple suggestions and rebased 👍 |
nathanjsweet
left a comment
There was a problem hiding this comment.
I like these changes, but I would like a better worded commit message.
Enhance the interface being used in order to configure the logging level
across the different components. This is an attempt to make it easier to understand
and use across the board compared to the current way of doing it.
Is quite vague. Please be more specific. Someting like:
Enhance the logging interface so that various levels of logrus logging can be used rather than just hard toggling between "info" and "debug"...
etc.
christarazi
left a comment
There was a problem hiding this comment.
LGTM pending Nate's suggestion
Enhance the logging interface so that various levels of logrus logging can be used rather than just hard toggling between "info" and "debug". Managing log `level` is now similarily done as the log `format`: - default is set with pkg/logging.DefaultLogLevel - getters and setters have been standardized and leveraged across other libraries too, eg: - SetLogLevel() - SetLogFormat() - GetLogLevel() - GetLogFormat() Signed-off-by: Maxime VISONNEAU <maxime.visonneau@gmail.com>
4bdca22 to
8727ec5
Compare
|
thanks for the review, I updated the commit details and rebased upon |
|
test-me-please |
|
test-me-please |
|
Hit flake #16159, marking as ready to merge. |
Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that cilium#16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
[ upstream commit 0f76833 ] Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
[ upstream commit 0f76833 ] Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
[ upstream commit 0f76833 ] Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
[ upstream commit 0f76833 ] Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
[ upstream commit 0f76833 ] Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
[ upstream commit 0f76833 ] Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that #16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Currently, disabling the config property `Debug` (`cilium-dbg config Debug=disable`) doesn't change the log level of the Cilium Agent (and proxies) back to the default log level. The log level stays at `debug`. The reason is that cilium#16021 changed the logging API from accepting the loglevel to explicit methods to enable debug level or reset it to the defaut log level. Hence it no longer supports toggling the log level. This commit fixes this by explicitly reset the log level of the default logger by calling `logging.SetDefaultLogLevel()` if the config option `Debug` is disabled. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Enhance the logging interface so that various levels of logrus logging can be used rather than just hard toggling between "info" and "debug".
Managing log
levelis now similarily done as the logformat:across other libraries too, eg:
Follow-up: #16002 & #16005