diff --git a/scripts/daemon/phabricator_daemon_launcher.php b/scripts/daemon/phabricator_daemon_launcher.php index 8283103b7f..ff6532bd61 100755 --- a/scripts/daemon/phabricator_daemon_launcher.php +++ b/scripts/daemon/phabricator_daemon_launcher.php @@ -163,7 +163,15 @@ switch (isset($argv[1]) ? $argv[1] : 'help') { $daemon = reset($match); } - will_launch($control); + $with_logs = true; + if ($is_debug) { + // In debug mode, we emit errors straight to stdout, so nothing useful + // will show up in the logs. Don't echo the message about stuff showing + // up in them, since it would be confusing. + $with_logs = false; + } + + will_launch($control, $with_logs); if ($is_debug) { echo "Launching {$daemon} in debug mode (nondaemonized)...\n"; @@ -217,10 +225,12 @@ function phd_load_tracked_repositories() { return $repositories; } -function will_launch($control) { +function will_launch($control, $with_logs = true) { echo "Staging launch...\n"; $control->pingConduit(); - $log_dir = $control->getControlDirectory('log').'/daemons.log'; - echo "NOTE: Logs will appear in '{$log_dir}'.\n\n"; + if ($with_logs) { + $log_dir = $control->getControlDirectory('log').'/daemons.log'; + echo "NOTE: Logs will appear in '{$log_dir}'.\n\n"; + } } diff --git a/src/infrastructure/daemon/control/PhabricatorDaemonControl.php b/src/infrastructure/daemon/control/PhabricatorDaemonControl.php index 938d890fba..f0549ca9c3 100644 --- a/src/infrastructure/daemon/control/PhabricatorDaemonControl.php +++ b/src/infrastructure/daemon/control/PhabricatorDaemonControl.php @@ -216,17 +216,24 @@ EOHELP "./launch_daemon.php ". "%s ". "--load-phutil-library=%s ". - implode(' ', $extra_libraries)." ". + "%C ". "--conduit-uri=%s ". "--phd=%s ". - "--log=%s ". - ($debug ? '--trace ' : '--daemonize '). - implode(' ', $argv), + ($debug ? '--trace ' : '--daemonize '), $daemon, phutil_get_library_root('phabricator'), + implode(' ', $extra_libraries), PhabricatorEnv::getURI('/api/'), - $pid_dir, - $log_dir); + $pid_dir); + + if (!$debug) { + // If we're running "phd debug", send output straight to the console + // instead of to a logfile. + $command = csprintf("%C --log=%s", $command, $log_dir); + } + + // Append the daemon's argv. + $command = csprintf("%C %C", $command, implode(' ', $argv)); if ($debug) { // Don't terminate when the user sends ^C; it will be sent to the