always debug where logging to on startup

This commit is contained in:
Joey Hess 2014-07-16 15:10:41 -04:00
parent a2a9650514
commit 9babd88e90

View file

@ -76,6 +76,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
Annex.changeState $ \s -> s { Annex.daemon = True } Annex.changeState $ \s -> s { Annex.daemon = True }
pidfile <- fromRepo gitAnnexPidFile pidfile <- fromRepo gitAnnexPidFile
logfile <- fromRepo gitAnnexLogFile logfile <- fromRepo gitAnnexLogFile
debugM desc $ "logging to " ++ logfile
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
createAnnexDirectory (parentDir logfile) createAnnexDirectory (parentDir logfile)
logfd <- liftIO $ handleToFd =<< openLog logfile logfd <- liftIO $ handleToFd =<< openLog logfile
@ -85,9 +86,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
fdToHandle =<< dup stdOutput fdToHandle =<< dup stdOutput
origerr <- liftIO $ catchMaybeIO $ origerr <- liftIO $ catchMaybeIO $
fdToHandle =<< dup stdError fdToHandle =<< dup stdError
let undaemonize a = do let undaemonize = Utility.Daemon.foreground logfd (Just pidfile)
debugM desc $ "logging to " ++ logfile
Utility.Daemon.foreground logfd (Just pidfile) a
start undaemonize $ start undaemonize $
case startbrowser of case startbrowser of
Nothing -> Nothing Nothing -> Nothing
@ -102,8 +101,6 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
createAnnexDirectory (parentDir logfile) createAnnexDirectory (parentDir logfile)
ifM (liftIO $ isNothing <$> getEnv flag) ifM (liftIO $ isNothing <$> getEnv flag)
( liftIO $ withFile devNull WriteMode $ \nullh -> do ( liftIO $ withFile devNull WriteMode $ \nullh -> do
when (not foreground) $
debugM desc $ "logging to " ++ logfile
loghandle <- openLog logfile loghandle <- openLog logfile
e <- getEnvironment e <- getEnvironment
cmd <- readProgramFile cmd <- readProgramFile