mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Show logs to the console in 'phd debug'
Summary: Currently we send logs to the logfile in 'phd debug', but we should send them to the console instead. Also fixed some %C stuff which could theoretically cause problems if a user had percentage symbols in their paths (heaven forbid). fratrik, this or D535 might have been involved in frustrating your efforts to debug the "sudo" stuff. Test Plan: Ran "phd debug irc derpderp" and "phd launch irc derpderp". In the former case, the exception appeared in the console. In the latter, it appeared in the log. Reviewed By: codeblock Reviewers: codeblock, jungejason, tuomaspelkonen, aran, fratrik CC: aran, codeblock Differential Revision: 536
This commit is contained in:
parent
451b0e07dc
commit
b61e325f05
2 changed files with 27 additions and 10 deletions
|
@ -163,7 +163,15 @@ switch (isset($argv[1]) ? $argv[1] : 'help') {
|
||||||
$daemon = reset($match);
|
$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) {
|
if ($is_debug) {
|
||||||
echo "Launching {$daemon} in debug mode (nondaemonized)...\n";
|
echo "Launching {$daemon} in debug mode (nondaemonized)...\n";
|
||||||
|
@ -217,10 +225,12 @@ function phd_load_tracked_repositories() {
|
||||||
return $repositories;
|
return $repositories;
|
||||||
}
|
}
|
||||||
|
|
||||||
function will_launch($control) {
|
function will_launch($control, $with_logs = true) {
|
||||||
echo "Staging launch...\n";
|
echo "Staging launch...\n";
|
||||||
$control->pingConduit();
|
$control->pingConduit();
|
||||||
|
if ($with_logs) {
|
||||||
$log_dir = $control->getControlDirectory('log').'/daemons.log';
|
$log_dir = $control->getControlDirectory('log').'/daemons.log';
|
||||||
echo "NOTE: Logs will appear in '{$log_dir}'.\n\n";
|
echo "NOTE: Logs will appear in '{$log_dir}'.\n\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,17 +216,24 @@ EOHELP
|
||||||
"./launch_daemon.php ".
|
"./launch_daemon.php ".
|
||||||
"%s ".
|
"%s ".
|
||||||
"--load-phutil-library=%s ".
|
"--load-phutil-library=%s ".
|
||||||
implode(' ', $extra_libraries)." ".
|
"%C ".
|
||||||
"--conduit-uri=%s ".
|
"--conduit-uri=%s ".
|
||||||
"--phd=%s ".
|
"--phd=%s ".
|
||||||
"--log=%s ".
|
($debug ? '--trace ' : '--daemonize '),
|
||||||
($debug ? '--trace ' : '--daemonize ').
|
|
||||||
implode(' ', $argv),
|
|
||||||
$daemon,
|
$daemon,
|
||||||
phutil_get_library_root('phabricator'),
|
phutil_get_library_root('phabricator'),
|
||||||
|
implode(' ', $extra_libraries),
|
||||||
PhabricatorEnv::getURI('/api/'),
|
PhabricatorEnv::getURI('/api/'),
|
||||||
$pid_dir,
|
$pid_dir);
|
||||||
$log_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) {
|
if ($debug) {
|
||||||
// Don't terminate when the user sends ^C; it will be sent to the
|
// Don't terminate when the user sends ^C; it will be sent to the
|
||||||
|
|
Loading…
Reference in a new issue