diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-17 17:17:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 17:17:27 -0400 |
commit | 7b00e49f657305f233e4e29613821305bf4d2962 (patch) | |
tree | 8470c3a4a002f93514762f7fe2eb37cc0396d44b /libpod/container_log.go | |
parent | daabbc1a1e82b840a51b6d769cdf19cfda474144 (diff) | |
parent | 0e171b7b3327948f2e9e32d9e496736bd7a48009 (diff) | |
download | podman-7b00e49f657305f233e4e29613821305bf4d2962.tar.gz podman-7b00e49f657305f233e4e29613821305bf4d2962.tar.bz2 podman-7b00e49f657305f233e4e29613821305bf4d2962.zip |
Merge pull request #6560 from mheon/fix_exec_logdriver
Do not share container log driver for exec
Diffstat (limited to 'libpod/container_log.go')
-rw-r--r-- | libpod/container_log.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libpod/container_log.go b/libpod/container_log.go index c3a84d048..071882bc2 100644 --- a/libpod/container_log.go +++ b/libpod/container_log.go @@ -21,12 +21,21 @@ func (r *Runtime) Log(containers []*Container, options *logs.LogOptions, logChan // ReadLog reads a containers log based on the input options and returns loglines over a channel. func (c *Container) ReadLog(options *logs.LogOptions, logChannel chan *logs.LogLine) error { - // TODO Skip sending logs until journald logs can be read - // TODO make this not a magic string - if c.LogDriver() == define.JournaldLogging { + switch c.LogDriver() { + case define.NoLogging: + return errors.Wrapf(define.ErrNoLogs, "this container is using the 'none' log driver, cannot read logs") + case define.JournaldLogging: + // TODO Skip sending logs until journald logs can be read return c.readFromJournal(options, logChannel) + case define.JSONLogging: + // TODO provide a separate implementation of this when Conmon + // has support. + fallthrough + case define.KubernetesLogging, "": + return c.readFromLogFile(options, logChannel) + default: + return errors.Wrapf(define.ErrInternal, "unrecognized log driver %q, cannot read logs", c.LogDriver()) } - return c.readFromLogFile(options, logChannel) } func (c *Container) readFromLogFile(options *logs.LogOptions, logChannel chan *logs.LogLine) error { |