Don't open log file until lock is held
Summary:
I was investigating a bug report, and noticed that a running
server was logging to `.log.old`. Since we mess with log files before we
hold the lock, it's totally possible for this to happen.
The new solution is to wait until we have the lock before setting up the
log files. The main downside is that a daemonized monitor has nowhere to
log between being spawned and the log file being set up. Not a huge
deal, though, since if something goes wrong, `flow start` will report
why the monitor died.
Reviewed By: avikchaudhuri
Differential Revision:
D6284950
fbshipit-source-id:
a218f91a12a7dcad70f363dd346df7f5853f6e51