Skip to content

Confusion on logging levels #4771

Closed
Closed
@criscola

Description

@criscola

Type of question

Open question

Question

What did you do?

ctrl.SetLogger(zap.Level(zapcore.Level(3))))

in my Reconcile method:

logger.V(3).Info("Reconcile called")

What did you expect to see?

I expected to see "Reconcile called" in my output logs.

What did you see instead? Under which circumstances?

Nothing.

Environment

Operator type:

/language go

Additional context

If I read the docs for zapcore.Level, it says "A Level is a logging priority. Higher levels are more important.", but here's what the docs for the Logger interface is saying "[..] higher verbosity level means a log message is less important", so it looks like a contradiction.

Am I misunderstanding how the logging levels are supposed to work? To me, the intention of the Logger interface appears more sensed, but when I try to manually set the logging level of zap, the behavior is not what I expect. Sorry if this is the wrong place to ask, but as the operator-sdk automatically scaffolds zap and logr together I thought it would be appropriated to talk about it here.

How do I set the desired level of logging manually (not through BindFlag)?

Metadata

Metadata

Assignees

Labels

language/goIssue is related to a Go operator projecttriage/supportIndicates an issue that is a support question.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions