fix the issue of accesslog closing the default writer os.Stdout by SetOutput() method

This commit is contained in:
lrita 2022-03-18 17:58:29 +08:00
parent af2d017e1b
commit d058d999b8

View File

@ -498,6 +498,10 @@ func (ac *AccessLog) setOutput(reset bool, writers ...io.Writer) {
}
for _, closer := range closers {
if closer != nil {
// cannot close os.Stdout/os.Stderr
if closer == os.Stdout || closer == os.Stderr {
continue
}
closer.Close()
}
}