/** * Logs an access to the server socket. * * This method is executed only if the access logger flag is set to true. * * @since 5.1 * @param integer $clientId Client id. * @param string $user Username given by the client. * @param string $command Command that the client asked to execute. */ protected function logAccess($clientId, $user, $command) { if ($this->accessLogEnabled) { $client = $this->serversocket->getClientInfo($clientId); $this->accessLogger->logEvent($user . '@' . $client['host'] . ' "' . $command . '"'); } }
/** * Launches a server process and watches it. * * @since 5.1 * @param string $command Command for launching server to be watched. * @return void */ public function watch($command) { print 'Module server started and monitored by watch dog.' . "\n"; while (true) { $result = $this->run($command); if (!strpos($result, 'Module server failed.') and strpos($result, 'Module server stopped.')) { break; } $context = ModuleServerContext::instance('\\Innomatic\\Module\\Server\\ModuleServerContext'); $logger = new ModuleServerLogger($context->getHome() . 'core/log/module-watchdog.log'); $logger->logEvent('------------------------------------------------------'); $logger->logEvent($result); print 'Module server restarted by watch dog.' . "\n"; } print 'Module server and watch dog stopped.' . "\n"; }