I would like to modify the logging a little bit by doing the following:
mw := io.MultiWriter(os.Stdout, logFile)
log.SetOutput(mw)
log.SetFormatter(&log.JSONFormatter{})
Because I am using the prometheus common log logger it seems to be impossible to do so. From my point of view using this logger seemed to be "best practice" but right now I am no longer that sure.
Can I achieve the changes I want with the prometheus logger or do I simply have to use the logrus directly?
UPDATE 0
Obviously further explanation about my goal is required :-) sorry for that...
I want to:
- Modify the log format so that it creates splunk-compatible json log messages.
- Write all log messages to stdout/stderr AND into a logfile.