Fail docker logs on all logging drivers apart from 'json-file'

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov
2015-03-13 15:02:09 -07:00
parent dd6d2cd660
commit bdf3a0295d
11 changed files with 67 additions and 3 deletions
+9
View File
@@ -1489,3 +1489,12 @@ func (container *Container) getNetworkedContainer() (*Container, error) {
func (container *Container) Stats() (*execdriver.ResourceStats, error) {
return container.daemon.Stats(container)
}
func (c *Container) LogDriverType() string {
c.Lock()
defer c.Unlock()
if c.hostConfig.LogConfig.Type == "" {
return c.daemon.defaultLogConfig.Type
}
return c.hostConfig.LogConfig.Type
}
+3
View File
@@ -44,6 +44,9 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) engine.Status {
if err != nil {
return job.Error(err)
}
if container.LogDriverType() != "json-file" {
return job.Errorf("\"logs\" endpoint is supported only for \"json-file\" logging driver")
}
cLog, err := container.ReadLog("json")
if err != nil && os.IsNotExist(err) {
// Legacy logs