diff --git a/scripts/daemon/launch_daemon.php b/scripts/daemon/launch_daemon.php --- a/scripts/daemon/launch_daemon.php +++ b/scripts/daemon/launch_daemon.php @@ -1,6 +1,8 @@ #!/usr/bin/env php future; } - public function setSilent($silent) { - $this->silent = $silent; - return $this; - } - - public function getSilent() { - return $this->silent; - } - public function setTraceMemory($trace_memory) { $this->traceMemory = $trace_memory; return $this; @@ -402,10 +392,7 @@ } private function logMessage($type, $message, $context = null) { - if (!$this->getSilent()) { - echo date('Y-m-d g:i:s A').' ['.$type.'] '.$message."\n"; - } - + $this->overseer->logMessage($type, $message, $context); $this->dispatchEvent( self::EVENT_DID_LOG, array( diff --git a/src/daemon/PhutilDaemonOverseer.php b/src/daemon/PhutilDaemonOverseer.php --- a/src/daemon/PhutilDaemonOverseer.php +++ b/src/daemon/PhutilDaemonOverseer.php @@ -148,7 +148,6 @@ $this->modules = PhutilDaemonOverseerModule::getAllModules(); - declare(ticks = 1); pcntl_signal(SIGUSR2, array($this, 'didReceiveNotifySignal')); pcntl_signal(SIGHUP, array($this, 'didReceiveReloadSignal')); @@ -181,7 +180,6 @@ 'autoscale' => $config['autoscale'], )); - $daemon->setSilent((!$this->traceMode && !$this->verbose)); $daemon->setTraceMemory($this->traceMemory); $this->addDaemon($daemon, $config); @@ -193,12 +191,18 @@ foreach ($this->modules as $module) { try { if ($module->shouldReloadDaemons()) { + $this->logMessage( + 'RELO', + pht( + 'Reloading daemons (triggered by overseer module "%s").', + get_class($module))); $should_reload = true; } } catch (Exception $ex) { phlog($ex); } } + if ($should_reload) { $this->didReceiveReloadSignal(SIGHUP); $should_reload = false; @@ -503,4 +507,10 @@ } } + public function logMessage($type, $message, $context = null) { + if ($this->traceMode || $this->verbose) { + error_log(date('Y-m-d g:i:s A').' ['.$type.'] '.$message); + } + } + }