Commit 48483a2e authored by Iustin Pop's avatar Iustin Pop

Two small logging improvements

The "starting" message is changed to match the Python one, and in case
the preparation fails, we also log the error (beside printing it on
stderr or writing it to the error reporting pipe), as at this time
logging is usually set up.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 73b16ca1
......@@ -371,10 +371,11 @@ fullPrep daemon opts syslog check_result prep_fn = do
then Nothing
else Just $ daemonLogFile daemon
pidfile = daemonPidFile daemon
setupLogging logfile (daemonName daemon) (optDebug opts) True False syslog
dname = daemonName daemon
setupLogging logfile dname (optDebug opts) True False syslog
_ <- describeError "writing PID file; already locked?"
Nothing (Just pidfile) $ writePidFile pidfile
logNotice "starting"
logNotice $ dname ++ " daemon startup"
prep_fn opts check_result
-- | Inner daemon function.
......@@ -404,6 +405,7 @@ handlePrepErr fd err = do
-- better (safer) than trying to convert this into a full handle
Just fd' -> fdWrite fd' msg >> return ()
Nothing -> hPutStrLn stderr (daemonStartupErr msg)
logError msg
exitWith $ ExitFailure 1
-- | Close a file descriptor.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment