Skip to content

Commit

Permalink
main: not reopen /dev/stderr
Browse files Browse the repository at this point in the history
commit a146081 introduced a change to
write to /dev/stderr by default.  Do not reopen the file in this case,
but use directly the fd 2.

Closes: opencontainers#2056
Closes: kubernetes/kubernetes#77615
Closes: cri-o/cri-o#2368

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed May 14, 2019
1 parent 70bc4cd commit 8383c72
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func main() {
},
cli.StringFlag{
Name: "log",
Value: "/dev/stderr",
Value: "",
Usage: "set the log file path where internal debug information is written",
},
cli.StringFlag{
Expand Down Expand Up @@ -157,9 +157,15 @@ func (f *FatalWriter) Write(p []byte) (n int, err error) {
}

func createLogConfig(context *cli.Context) logs.Config {
logFilePath := context.GlobalString("log")
logPipeFd := ""
if logFilePath == "" {
logPipeFd = "2"
}
config := logs.Config{
LogPipeFd: logPipeFd,
LogLevel: logrus.InfoLevel,
LogFilePath: context.GlobalString("log"),
LogFilePath: logFilePath,
LogFormat: context.GlobalString("log-format"),
}
if context.GlobalBool("debug") {
Expand Down

0 comments on commit 8383c72

Please sign in to comment.