Skip to content

Commit

Permalink
Make logs reopen if thier files are deletd or moved.
Browse files Browse the repository at this point in the history
  • Loading branch information
factom-clay committed Dec 12, 2018
1 parent ddc4817 commit 3b4b5d3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common/messages/messageTrace.go
Expand Up @@ -74,6 +74,14 @@ func getTraceFile(name string) (f *os.File) {
files = make(map[string]*os.File)
}
f, _ = files[name]
if f != nil {
_, err := os.Stat(name)
if os.IsNotExist(err) {
// The file was deleted out from under us
f.Close() // close the old log
}
f = nil // make the code reopen the file
}
if f == nil {
fmt.Println("Creating " + name)
var err error
Expand Down

0 comments on commit 3b4b5d3

Please sign in to comment.