jimmidyson / configmap-reload

Simple binary to trigger a reload when a Kubernetes ConfigMap is updated
Apache License 2.0
983 stars 193 forks source link

Info logs are written to stderr #60

Open adriferracuti opened 3 years ago

adriferracuti commented 3 years ago

Hi, first of all thank you very much!

I noticed that the info logs are written to stderr, thus showing up as errors on the GCP logs explorer (Kubernetes): Screenshot 2021-09-13 at 15 04 51

mac2000 commented 2 years ago

Seems like it is by design, from docs:

That logger writes to standard error and prints the date and time of each logged message.

So with standard packages all fmt.Print("Hello") goes to stdout, and log.Print("World") to stderr

Workaround for this might be to redefine output with help of SetOutput, like:

log.SetOutput(os.Stdout)

Or even add an optional flag that will switch behavior