configmap-reload icon indicating copy to clipboard operation
configmap-reload copied to clipboard

Info logs are written to stderr

Open adriferracuti opened this issue 3 years ago • 1 comments

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

adriferracuti avatar Sep 13 '21 13:09 adriferracuti

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

mac2000 avatar Nov 25 '21 15:11 mac2000