-
Notifications
You must be signed in to change notification settings - Fork 175
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
Support SIGUSR1 log level incrementing #3685
Conversation
This commit adds support to sensu-backend and sensu-agent for incrementing the log level with SIGUSR1. When the process receives this signal, the log level will be incremented in terms of verbosity. When the level is at TRACE, the most verbose log level, and the log level is incremented, it will wrap around to error level. Signed-off-by: Eric Chlebek <[email protected]>
@echlebek looks like it broke the Windows builds 😱 |
Signed-off-by: Eric Chlebek <[email protected]>
@palourde I moved the signal handling stuff into some files that won't get built on Windows, which seems to have un-broken the build. |
I figured this is expected, but I'm wondering if there's a way to by-pass the following behavior: When the log level is incremented from trace --> error, the following entry is logged, which is expected:
However, when we go from error --> warning, the same entry never gets logged. I'm wondering if we could add a condition so when the current log level is logrus.Warnf("set log level to %s", newLevel)
logrus.SetLevel(newLevel)
// Log back the entry if the level passed from error to warning
if logrus.GetLevel() == logrus.WarningLevel {
logrus.Warnf("set log level to %s", newLevel)
} WDYT? |
It's a bit of an oddity, but I like that it makes the message appear in all cases. I'll add it! |
Signed-off-by: Eric Chlebek <[email protected]>
Signed-off-by: Eric Chlebek <[email protected]>
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.
🚀
What is this change?
This commit adds support to sensu-backend and sensu-agent for
incrementing the log level with SIGUSR1. When the process receives
this signal, the log level will be incremented in terms of
verbosity. When the level is at TRACE, the most verbose log level,
and the log level is incremented, it will wrap around to error
level.
Why is this change necessary?
Closes #1742
Does your change need a Changelog entry?
Yes
Were there any complications while making this change?
It's unclear at this time how to support this for Windows.
Have you reviewed and updated the documentation for this change? Is new documentation required?
@hillaryfraley, we will need to document that users can now increase the log level at runtime, with the following commands for backends and agents:
How did you verify this change?
I ran the above commands for the backend and agent.
Is this change a patch?
No.