mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-03 18:04:16 +00:00
Merge pull request #1036 from lifupan/fixlog
shimv2: discard log before shim init log output
This commit is contained in:
@@ -8,6 +8,7 @@ package containerdshim
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
sysexec "os/exec"
|
sysexec "os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -56,9 +57,13 @@ var vci vc.VC = &vc.VCImpl{}
|
|||||||
// New returns a new shim service that can be used via GRPC
|
// 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) {
|
func New(ctx context.Context, id string, publisher events.Publisher) (cdshim.Shim, error) {
|
||||||
logger := logrus.WithField("ID", id)
|
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)
|
vci.SetLogger(ctx, logger)
|
||||||
katautils.SetLogger(ctx, logger, logger.Logger.Level)
|
katautils.SetLogger(ctx, logger, logger.Logger.Level)
|
||||||
_, runtimeConfig, err := katautils.LoadConfiguration("", true, true)
|
_, runtimeConfig, err := katautils.LoadConfiguration("", false, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user