mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix stderr logging for journald and syslog
logger.PutMessage, added in #28762 (v17.04.0-ce), clears msg.Source. So journald and syslog were treating stderr messages as if they were stdout. Signed-off-by: David Glasser <glasser@davidglasser.net>
This commit is contained in:
parent
33fd3817b0
commit
917050c572
2 changed files with 4 additions and 2 deletions
|
@ -112,9 +112,10 @@ func (s *journald) Log(msg *logger.Message) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
line := string(msg.Line)
|
line := string(msg.Line)
|
||||||
|
source := msg.Source
|
||||||
logger.PutMessage(msg)
|
logger.PutMessage(msg)
|
||||||
|
|
||||||
if msg.Source == "stderr" {
|
if source == "stderr" {
|
||||||
return journal.Send(line, journal.PriErr, vars)
|
return journal.Send(line, journal.PriErr, vars)
|
||||||
}
|
}
|
||||||
return journal.Send(line, journal.PriInfo, vars)
|
return journal.Send(line, journal.PriInfo, vars)
|
||||||
|
|
|
@ -133,8 +133,9 @@ func New(info logger.Info) (logger.Logger, error) {
|
||||||
|
|
||||||
func (s *syslogger) Log(msg *logger.Message) error {
|
func (s *syslogger) Log(msg *logger.Message) error {
|
||||||
line := string(msg.Line)
|
line := string(msg.Line)
|
||||||
|
source := msg.Source
|
||||||
logger.PutMessage(msg)
|
logger.PutMessage(msg)
|
||||||
if msg.Source == "stderr" {
|
if source == "stderr" {
|
||||||
return s.writer.Err(line)
|
return s.writer.Err(line)
|
||||||
}
|
}
|
||||||
return s.writer.Info(line)
|
return s.writer.Info(line)
|
||||||
|
|
Loading…
Reference in a new issue