Eliminate the redundant parameter
| ... | ... |
@@ -322,10 +322,11 @@ func (container *Container) CheckpointDir() string {
|
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
// StartLogger starts a new logger driver for the container. |
| 325 |
-func (container *Container) StartLogger(cfg containertypes.LogConfig) (logger.Logger, error) {
|
|
| 325 |
+func (container *Container) StartLogger() (logger.Logger, error) {
|
|
| 326 |
+ cfg := container.HostConfig.LogConfig |
|
| 326 | 327 |
c, err := logger.GetLogDriver(cfg.Type) |
| 327 | 328 |
if err != nil {
|
| 328 |
- return nil, fmt.Errorf("Failed to get logging factory: %v", err)
|
|
| 329 |
+ return nil, fmt.Errorf("failed to get logging factory: %v", err)
|
|
| 329 | 330 |
} |
| 330 | 331 |
ctx := logger.Context{
|
| 331 | 332 |
Config: cfg.Config, |
| ... | ... |
@@ -1050,9 +1051,9 @@ func (container *Container) startLogging() error {
|
| 1050 | 1050 |
return nil // do not start logging routines |
| 1051 | 1051 |
} |
| 1052 | 1052 |
|
| 1053 |
- l, err := container.StartLogger(container.HostConfig.LogConfig) |
|
| 1053 |
+ l, err := container.StartLogger() |
|
| 1054 | 1054 |
if err != nil {
|
| 1055 |
- return fmt.Errorf("Failed to initialize logging driver: %v", err)
|
|
| 1055 |
+ return fmt.Errorf("failed to initialize logging driver: %v", err)
|
|
| 1056 | 1056 |
} |
| 1057 | 1057 |
|
| 1058 | 1058 |
copier := logger.NewCopier(map[string]io.Reader{"stdout": container.StdoutPipe(), "stderr": container.StderrPipe()}, l)
|
| ... | ... |
@@ -117,7 +117,7 @@ func (daemon *Daemon) getLogger(container *container.Container) (logger.Logger, |
| 117 | 117 |
if container.LogDriver != nil && container.IsRunning() {
|
| 118 | 118 |
return container.LogDriver, nil |
| 119 | 119 |
} |
| 120 |
- return container.StartLogger(container.HostConfig.LogConfig) |
|
| 120 |
+ return container.StartLogger() |
|
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
// mergeLogConfig merges the daemon log config to the container's log config if the container's log driver is not specified. |
| ... | ... |
@@ -4497,7 +4497,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
|
| 4497 | 4497 |
|
| 4498 | 4498 |
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
|
| 4499 | 4499 |
c.Assert(err, checker.NotNil) |
| 4500 |
- c.Assert(out, checker.Contains, "Failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4500 |
+ c.Assert(out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4501 | 4501 |
|
| 4502 | 4502 |
// NGoroutines is not updated right away, so we need to wait before failing |
| 4503 | 4503 |
c.Assert(waitForGoroutines(nroutines), checker.IsNil) |