Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15414455
D16053.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16053.diff
View Options
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
<?php
+declare(ticks = 1);
+
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$overseer = new PhutilDaemonOverseer($argv);
diff --git a/src/daemon/PhutilDaemonHandle.php b/src/daemon/PhutilDaemonHandle.php
--- a/src/daemon/PhutilDaemonHandle.php
+++ b/src/daemon/PhutilDaemonHandle.php
@@ -18,7 +18,6 @@
private $heartbeat;
private $stdoutBuffer;
private $restartAt;
- private $silent;
private $shouldRestart = true;
private $shouldShutdown;
private $future;
@@ -57,15 +56,6 @@
return $this->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);
+ }
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 12:38 AM (1 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223832
Default Alt Text
D16053.diff (2 KB)
Attached To
Mode
D16053: Log when daemons trigger a reload in response to config changes
Attached
Detach File
Event Timeline
Log In to Comment