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

Proposal: better initialization of log verbosity level #1098

Closed
slintes opened this Issue May 31, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@slintes
Member

slintes commented May 31, 2018

Neither that important nor urgent, but this catched my eyes when looking into our logging implementation:

Currently we initialize both verbosityLevel and currentVerbosityLevel level to the same value, either what's given with the verbosity command line flag, or 0 [1].
Also, info level logs are actually logged when currentVerbosityLevel <= verbosityLevel [2]. That means as long as the V(currentVerbosityLevel) func isn't called, all Info(...) logs are always logged, even when the verbosity flag is specified with --v=0... not sure if that is what we want, and what the user expects.

Proposal:

  • According to [3] verbosity level 2 is the "recommended default log level for most systems". So if no verbosity flag is specified, set verbosityLevel to 2.
  • I think currentVerbosityLevel should be initialized indepent of verbosityLevel, always to the same value. A good value might be 2 or 3 (see [3]):
    • 2 means: "Useful steady state information about the service and important log messages that may correlate to significant changes in the system."
    • 3 means: "Extended information about changes. More info about system state changes."
      I'd propose to use 2, because
      • that would mean no change in behaviour compared to now when no verbosity flag is provided: Info(...) logs without V(...) will be logged because currentVerbosityLevel == verbosityLevel == 2.
      • if verbosity flag 0 or 1 is provided, you see less logs, which is very likely expected behaviour imho

Wdyt?

[1] https://github.com/kubevirt/kubevirt/blob/master/pkg/log/log.go#L97
[2] https://github.com/kubevirt/kubevirt/blob/master/pkg/log/log.go#L172
[3] https://github.com/kubernetes/community/blob/master/contributors/devel/logging.md

slintes added a commit to slintes/kubevirt that referenced this issue Jun 6, 2018

Better default log verbosity initialization
Fixes #1098

Signed-off-by: Marc Sluiter <marc@slintes.net>

slintes added a commit to slintes/kubevirt that referenced this issue Jun 6, 2018

Better default log verbosity initialization
Fixes #1098

Signed-off-by: Marc Sluiter <msluiter@redhat.com>

@fabiand fabiand added this to the MVP 0.1.2 milestone Jun 7, 2018

@rmohr rmohr closed this in #1109 Jun 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment