Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1036 from lifupan/fixlog
Browse files Browse the repository at this point in the history
shimv2: discard log before shim init log output
  • Loading branch information
jodh-intel authored Dec 20, 2018
2 parents f22370c + 05be5bf commit 10559f0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package containerdshim
import (
"context"
"encoding/json"
"io/ioutil"
"os"
sysexec "os/exec"
"path/filepath"
Expand Down Expand Up @@ -56,9 +57,13 @@ var vci vc.VC = &vc.VCImpl{}
// New returns a new shim service that can be used via GRPC
func New(ctx context.Context, id string, publisher events.Publisher) (cdshim.Shim, error) {
logger := logrus.WithField("ID", id)
// Discard the log before shim init its log output. Otherwise
// it will output into stdio, from which containerd would like
// to get the shim's socket address.
logrus.SetOutput(ioutil.Discard)
vci.SetLogger(ctx, logger)
katautils.SetLogger(ctx, logger, logger.Logger.Level)
_, runtimeConfig, err := katautils.LoadConfiguration("", true, true)
_, runtimeConfig, err := katautils.LoadConfiguration("", false, true)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 10559f0

Please sign in to comment.