Skip to content
Permalink
Browse files

main: not reopen /dev/stderr

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: #2056
Closes: kubernetes/kubernetes#77615
Closes: cri-o/cri-o#2368

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information...
giuseppe committed May 14, 2019
1 parent 70bc4cd commit 8383c724a4d76ab031159115127b32619a151099
Showing with 8 additions and 2 deletions.
  1. +8 −2 main.go
10 main.go
@@ -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{
@@ -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") {

0 comments on commit 8383c72

Please sign in to comment.
You can’t perform that action at this time.