Skip to content

Commit

Permalink
Merge pull request #3094 from apostasie/dev-3092
Browse files Browse the repository at this point in the history
Restore logger output
  • Loading branch information
AkihiroSuda committed Jun 16, 2024
2 parents ba876fb + f4a7e0c commit 60cf112
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/ocihook/ocihook.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ func Run(stdin io.Reader, stderr io.Writer, event, dataStore, cniPath, cniNetcon
if err != nil {
return err
}
defer logFile.Close()
currentOutput := log.L.Logger.Out
log.L.Logger.SetOutput(io.MultiWriter(stderr, logFile))
defer func() {
log.L.Logger.SetOutput(currentOutput)
err = logFile.Close()
if err != nil {
log.L.Logger.WithError(err).Error("failed closing oci hook log file")
}
}()

opts, err := newHandlerOpts(&state, dataStore, cniPath, cniNetconfPath)
if err != nil {
Expand Down

0 comments on commit 60cf112

Please sign in to comment.