logmon: log stat error to help debugging

This commit is contained in:
Mahmood Ali 2019-08-26 10:10:20 -04:00
parent 6301725002
commit 1851820f20

View file

@ -204,7 +204,8 @@ func newLogRotatorWrapper(path string, logger hclog.Logger, rotator io.WriteClos
var openFn func() (io.ReadCloser, error)
var err error
if _, ferr := os.Stat(path); os.IsNotExist(ferr) {
_, serr := os.Stat(path)
if os.IsNotExist(serr) {
openFn, err = fifo.CreateAndRead(path)
} else {
openFn = func() (io.ReadCloser, error) {
@ -213,6 +214,7 @@ func newLogRotatorWrapper(path string, logger hclog.Logger, rotator io.WriteClos
}
if err != nil {
logger.Error("failed to create FIFO", "stat_error", serr, "create_err", err)
return nil, fmt.Errorf("failed to create fifo for extracting logs: %v", err)
}