inconsistent logging
bn222 opened this issue · comments
We should use the same logging lib throughout the operator.
As discussed during last community meeting, here is a summary of logs around the operator.
Current state:
- a.
config-daemon
uses github.com/golang/glog with verbosisty levels 0 (info), 1 (debug) and 2 (trace) - b. SriovOperatorConfig.Spec.LogLevel
- b1. The field has the following documentation:
Flag to control the log verbose level of the operator. Set to '0' to show only the basic logs. And set to '2' to show all the available logs.
-
c. The field only affects the config-daemon, which changes the logging level at runtime in pkg/daemon/daemon.go#L437
-
d. The operator uses
controller-runtime/pkg/log
:- d1. "sigs.k8s.io/controller-runtime/pkg/log" is a proxy for "github.com/go-logr/logr", which in turn is an abstract logger
- d2. Logger implementation is set to "go.uber.org/zap/zapcore" in main.go#L85
- d2a. We set
zap.Options.Development = true
, that forcesencoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn
zap.go#L255
- d2a. We set
- d3. Every log line is logged with V(0), verbosity info
-
e. The operator has a few
log.Printf
calls: (e.g. pkg/apply/apply.go#L27)
My proposal here includes:
- p1. Reconfigure the
zap
logging level at runtime of the operator followingSriovOperatorConfig.Spec.LogLevel
value. - p2. Remove
zap.Options.Development = true
as it inhibits any loglevel change (tested manually)- p2a. Set the
encoder=consoleEncoder
to keep the same log output as before.
- p2a. Set the
- p3. Remove every
log.Printf(...)
call, as they cannot be filtered by the LogLevel field
with #527 all logs in project use controller-runtime log (zap + logr)
same logging config is used for both controller and daemon.
controller logs no longer use development mode.
the only work item which is left is:
p1. Reconfigure the zap logging level at runtime of the operator following SriovOperatorConfig.Spec.LogLevel value.
currently, the only way to configure controller log level is via cmdline flags during deployment.
the only work item which is left is:
p1. Reconfigure the zap logging level at runtime of the operator following SriovOperatorConfig.Spec.LogLevel value.
currently, the only way to configure controller log level is via cmdline flags during deployment.
I addressed that in
PRs:
address all the points I had for this issue. Though many other improvements can be developed about logging, I'm ok to close this issue as completed. @bn222, @adrianchiris WDYT?
From my side, i consider this issue as complete.
this issue should be closed we have everything in place thanks everyone!