Don't log twice to debug log when --log isn't set
PiperOrigin-RevId: 235940853 Change-Id: I9c5b4cf18b199fb74044a5edb131bfff59dec945
This commit is contained in:
parent
d516ee3312
commit
6df212b831
|
@ -192,7 +192,13 @@ func main() {
|
||||||
cmd.Fatalf("error dup'ing fd %d to stderr: %v", f.Fd(), err)
|
cmd.Fatalf("error dup'ing fd %d to stderr: %v", f.Fd(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
e = log.MultiEmitter{e, newEmitter(*debugLogFormat, f)}
|
if logFile == os.Stderr {
|
||||||
|
// Suppress logging to stderr when debug log is enabled. Otherwise all
|
||||||
|
// messages will be duplicated in the debug log (see Dup2() call above).
|
||||||
|
e = newEmitter(*debugLogFormat, f)
|
||||||
|
} else {
|
||||||
|
e = log.MultiEmitter{e, newEmitter(*debugLogFormat, f)}
|
||||||
|
}
|
||||||
} else if *debugLog != "" {
|
} else if *debugLog != "" {
|
||||||
f, err := specutils.DebugLogFile(*debugLog, subcommand)
|
f, err := specutils.DebugLogFile(*debugLog, subcommand)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -202,6 +202,11 @@ func runTestCaseRunsc(testBin string, tc gtest.TestCase, t *testing.T) {
|
||||||
debugLogDir += "/"
|
debugLogDir += "/"
|
||||||
log.Infof("runsc logs: %s", debugLogDir)
|
log.Infof("runsc logs: %s", debugLogDir)
|
||||||
args = append(args, "-debug-log", debugLogDir)
|
args = append(args, "-debug-log", debugLogDir)
|
||||||
|
|
||||||
|
// Default -log sends messages to stderr which makes reading the test log
|
||||||
|
// difficult. Instead, drop them when debug log is enabled given it's a
|
||||||
|
// better place for these messages.
|
||||||
|
args = append(args, "-log=/dev/null")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current process doesn't have CAP_SYS_ADMIN, create user namespace and run
|
// Current process doesn't have CAP_SYS_ADMIN, create user namespace and run
|
||||||
|
|
Loading…
Reference in New Issue