Closed
Description
FEATURE REQUEST:
/kind feature
What happened:
Kubernetes uses golang/glog extensively for logging. While this is reasonable enough for the Kubernetes binaries, sizeable parts of the codebase are re-used as client libraries (eg. k8s.io/client-go
). This presents several problems for users of the libraries:
- glog registers a bunch of flags in an
init
function, and offers no programmatic way to configure its behaviour. It can be surprising to users of the k8s libraries that they have to callflag.Parse()
, and this is easy to get wrong (eg. No way to configure glog coredns/coredns#1597). - glog's default behaviour is to log to a file on disk. A user of a library wouldn't typically expect it to write files without explicitly configuring it to do so.
- Worse, if glog cannot create a file, it calls
os.Exit
. This can be very harmful, and since it's common to run containerised binaries with a read-only root filesystem, can be easy to trigger. - glog doesn't perform any management of the files it writes, so without something like
logrotate
running (especially problematic in a container) the log files just accumulate.
I think we need to find a way to fix this: the use of glog makes working with the k8s client libraries very difficult. A recent Twitter discussion on this topic shows this is a widely-held concern.