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

Duplicate logs when Error or Warning #393

Closed
Andrea-Campanella opened this issue Jun 24, 2019 · 2 comments
Closed

Duplicate logs when Error or Warning #393

Andrea-Campanella opened this issue Jun 24, 2019 · 2 comments
Labels
bug 🪲 Something isn't working

Comments

@Andrea-Campanella
Copy link
Contributor

Describe the bug
Logging is duplicated when is Error or Warning

To Reproduce
Steps to reproduce the behavior:

  1. Run make run-docker
  2. docker logs <container_id>
  3. check any error or warning log.

Expected behavior
The log should be issued just once.

Screenshots
W0624 12:43:20.940243 1 synchronizer.go:60] could not create a gNMI client: Dialer(localhost:50001, 5s): context deadline exceeded
W0624 12:43:20.940243 1 synchronizer.go:60] could not create a gNMI client: Dialer(localhost:50001, 5s): context deadline exceeded
W0624 12:43:20.940358 1 factory.go:43] Error in connecting to client: could not create a gNMI client: Dialer(localhost:50001, 5s): context deadline exceeded
W0624 12:43:20.940358 1 factory.go:43] Error in connecting to client: could not create a gNMI client: Dialer(localhost:50001, 5s)

@Andrea-Campanella Andrea-Campanella added the bug 🪲 Something isn't working label Jun 24, 2019
@Andrea-Campanella
Copy link
Contributor Author

log.SetOutput(os.Stdout) line 93 of onos-config

@Andrea-Campanella
Copy link
Contributor Author

this could be easily fixed by doing

log.InitFlags(nil) for klog
but if other projects in the dependency set import glog the two are not compatibile and an error is thrown at runtime

/var/folders/4q/4x8mxbcd6hxbg79vtn04jjsr0000gn/T/go-build901010861/b001/exe/onos-config flag redefined: log_dir
panic: /var/folders/4q/4x8mxbcd6hxbg79vtn04jjsr0000gn/T/go-build901010861/b001/exe/onos-config flag redefined: log_dir

goroutine 1 [running]:
flag.(*FlagSet).Var(0xc000092120, 0x46cd6c0, 0x4acfa90, 0x460dd8c, 0x7, 0x4625087, 0x2f)
	/usr/local/go/src/flag/flag.go:850 +0x4af
flag.(*FlagSet).StringVar(...)
	/usr/local/go/src/flag/flag.go:753
k8s.io/klog.InitFlags(0x0)
	/Users/andrea/go/pkg/mod/k8s.io/klog@v0.3.3/klog.go:427 +0x9d
main.main()
	/Users/andrea/go/src/github.com/onosproject/onos-config/cmd/onos-config/onos-config.go:76 +0x3f

This is a know problem see:
kubernetes/client-go#83
kubernetes/client-go#19
The solution proposed in #398 was found here
https://github.com/kubernetes/klog/blob/master/README.md
https://github.com/kubernetes/klog/blob/master/examples/coexist_glog/coexist_glog.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Development

No branches or pull requests

1 participant