Merge pull request #1148 from congliu01/log
Override container log path to empty if either of sandbox log directory or container log path is empty.
This commit is contained in:
commit
6e14e01307
@ -192,9 +192,14 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
|
|||||||
meta.ImageRef = image.ID
|
meta.ImageRef = image.ID
|
||||||
meta.StopSignal = image.ImageSpec.Config.StopSignal
|
meta.StopSignal = image.ImageSpec.Config.StopSignal
|
||||||
|
|
||||||
// Get container log path.
|
// Validate log paths and compose full container log path.
|
||||||
if config.GetLogPath() != "" {
|
if sandboxConfig.GetLogDirectory() != "" && config.GetLogPath() != "" {
|
||||||
meta.LogPath = filepath.Join(sandboxConfig.GetLogDirectory(), config.GetLogPath())
|
meta.LogPath = filepath.Join(sandboxConfig.GetLogDirectory(), config.GetLogPath())
|
||||||
|
logrus.Debugf("Composed container full log path %q using sandbox log dir %q and container log path %q",
|
||||||
|
meta.LogPath, sandboxConfig.GetLogDirectory(), config.GetLogPath())
|
||||||
|
} else {
|
||||||
|
logrus.Infof("Logging will be disabled due to empty log paths for sandbox (%q) or container (%q)",
|
||||||
|
sandboxConfig.GetLogDirectory(), config.GetLogPath())
|
||||||
}
|
}
|
||||||
|
|
||||||
containerIO, err := cio.NewContainerIO(id,
|
containerIO, err := cio.NewContainerIO(id,
|
||||||
|
Loading…
Reference in New Issue
Block a user