Skip to content
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

[Bug] Non modyficable zap options with development: true hardcoded #982

Open
grzesuav opened this issue Dec 6, 2024 · 1 comment
Open
Labels
bug Something isn't working needs-triage Needs thorough attention from code reviewers

Comments

@grzesuav
Copy link

grzesuav commented Dec 6, 2024

Current Behavior

https://github.com/cryostatio/cryostat-operator/blob/main/internal/main.go#L88

there is

	opts := zap.Options{
		Development: true,
	}

which is not suitable for production use.

Expected Behavior

I would like to have configuration option for:

  • log level - via --log-level flag
  • log format - --log-format=json example flag

Steps To Reproduce

No response

Environment

- OS: 
- Environment: 
- Version:

Anything else?

If this is configurable otherwise would appreciate some pointers

@grzesuav grzesuav added bug Something isn't working needs-triage Needs thorough attention from code reviewers labels Dec 6, 2024
@andrewazores
Copy link
Member

andrewazores commented Dec 6, 2024

https://sdk.operatorframework.io/docs/building-operators/golang/references/logging/

opts.BindFlags(flag.CommandLine)

I haven't looked at this in a very long time, or tested this out recently, but I think it's intended that you can already pass through flags for zap to use. I don't know how that works with Development: true being hardcoded though.

https://github.com/kubernetes-sigs/controller-runtime/blob/717b32aede14c921d239cf1b974a11e718949865/pkg/log/zap/zap.go#L257

If you pass --zap-devel=false, maybe that will override the Development: true hardcoded value that is set before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Needs thorough attention from code reviewers
Projects
None yet
Development

No branches or pull requests

2 participants