Merge pull request #9734 from annando/issue-9704
Issue 9704: Improved log levels
This commit is contained in:
commit
b10cd8772c
|
@ -179,7 +179,7 @@ class Process
|
||||||
$reached = ($free < $min_memory);
|
$reached = ($free < $min_memory);
|
||||||
|
|
||||||
if ($reached) {
|
if ($reached) {
|
||||||
$this->logger->debug('Minimal memory reached.', ['free' => $free, 'memtotal' => $meminfo['MemTotal'], 'limit' => $min_memory]);
|
$this->logger->warning('Minimal memory reached.', ['free' => $free, 'memtotal' => $meminfo['MemTotal'], 'limit' => $min_memory]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reached;
|
return $reached;
|
||||||
|
@ -209,7 +209,7 @@ class Process
|
||||||
$load = System::currentLoad();
|
$load = System::currentLoad();
|
||||||
if ($load) {
|
if ($load) {
|
||||||
if (intval($load) > $maxsysload) {
|
if (intval($load) > $maxsysload) {
|
||||||
$this->logger->info('system load for process too high.', ['load' => $load, 'process' => $process, 'maxsysload' => $maxsysload]);
|
$this->logger->warning('system load for process too high.', ['load' => $load, 'process' => $process, 'maxsysload' => $maxsysload]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ class Process
|
||||||
public function run($command, $args)
|
public function run($command, $args)
|
||||||
{
|
{
|
||||||
if (!function_exists('proc_open')) {
|
if (!function_exists('proc_open')) {
|
||||||
$this->logger->notice('"proc_open" not available - quitting');
|
$this->logger->warning('"proc_open" not available - quitting');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class Process
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isMinMemoryReached()) {
|
if ($this->isMinMemoryReached()) {
|
||||||
$this->logger->notice('Memory limit reached - quitting');
|
$this->logger->warning('Memory limit reached - quitting');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ class Process
|
||||||
$resource = proc_open($cmdline . ' &', [], $foo, $this->basePath);
|
$resource = proc_open($cmdline . ' &', [], $foo, $this->basePath);
|
||||||
}
|
}
|
||||||
if (!is_resource($resource)) {
|
if (!is_resource($resource)) {
|
||||||
$this->logger->notice('We got no resource for command.', ['command' => $cmdline]);
|
$this->logger->warning('We got no resource for command.', ['command' => $cmdline]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
proc_close($resource);
|
proc_close($resource);
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Worker
|
||||||
|
|
||||||
// The work will be done
|
// The work will be done
|
||||||
if (!self::execute($entry)) {
|
if (!self::execute($entry)) {
|
||||||
Logger::info('Process execution failed, quitting.');
|
Logger::notice('Process execution failed, quitting.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,14 +125,14 @@ class Worker
|
||||||
if (DI::lock()->acquire(self::LOCK_WORKER, 0)) {
|
if (DI::lock()->acquire(self::LOCK_WORKER, 0)) {
|
||||||
// Count active workers and compare them with a maximum value that depends on the load
|
// Count active workers and compare them with a maximum value that depends on the load
|
||||||
if (self::tooMuchWorkers()) {
|
if (self::tooMuchWorkers()) {
|
||||||
Logger::info('Active worker limit reached, quitting.');
|
Logger::notice('Active worker limit reached, quitting.');
|
||||||
DI::lock()->release(self::LOCK_WORKER);
|
DI::lock()->release(self::LOCK_WORKER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check free memory
|
// Check free memory
|
||||||
if (DI::process()->isMinMemoryReached()) {
|
if (DI::process()->isMinMemoryReached()) {
|
||||||
Logger::notice('Memory limit reached, quitting.');
|
Logger::warning('Memory limit reached, quitting.');
|
||||||
DI::lock()->release(self::LOCK_WORKER);
|
DI::lock()->release(self::LOCK_WORKER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -168,25 +168,25 @@ class Worker
|
||||||
{
|
{
|
||||||
// Count active workers and compare them with a maximum value that depends on the load
|
// Count active workers and compare them with a maximum value that depends on the load
|
||||||
if (self::tooMuchWorkers()) {
|
if (self::tooMuchWorkers()) {
|
||||||
Logger::info('Active worker limit reached, quitting.');
|
Logger::notice('Active worker limit reached, quitting.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we have too few memory?
|
// Do we have too few memory?
|
||||||
if (DI::process()->isMinMemoryReached()) {
|
if (DI::process()->isMinMemoryReached()) {
|
||||||
Logger::notice('Memory limit reached, quitting.');
|
Logger::warning('Memory limit reached, quitting.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possibly there are too much database connections
|
// Possibly there are too much database connections
|
||||||
if (self::maxConnectionsReached()) {
|
if (self::maxConnectionsReached()) {
|
||||||
Logger::notice('Maximum connections reached, quitting.');
|
Logger::warning('Maximum connections reached, quitting.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possibly there are too much database processes that block the system
|
// Possibly there are too much database processes that block the system
|
||||||
if (DI::process()->isMaxProcessesReached()) {
|
if (DI::process()->isMaxProcessesReached()) {
|
||||||
Logger::notice('Maximum processes reached, quitting.');
|
Logger::warning('Maximum processes reached, quitting.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,13 +290,13 @@ class Worker
|
||||||
|
|
||||||
// Constantly check the number of parallel database processes
|
// Constantly check the number of parallel database processes
|
||||||
if (DI::process()->isMaxProcessesReached()) {
|
if (DI::process()->isMaxProcessesReached()) {
|
||||||
Logger::notice("Max processes reached for process", ['pid' => $mypid]);
|
Logger::warning("Max processes reached for process", ['pid' => $mypid]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constantly check the number of available database connections to let the frontend be accessible at any time
|
// Constantly check the number of available database connections to let the frontend be accessible at any time
|
||||||
if (self::maxConnectionsReached()) {
|
if (self::maxConnectionsReached()) {
|
||||||
Logger::notice("Max connection reached for process", ['pid' => $mypid]);
|
Logger::warning("Max connection reached for process", ['pid' => $mypid]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ class Worker
|
||||||
$level = ($used / $max) * 100;
|
$level = ($used / $max) * 100;
|
||||||
|
|
||||||
if ($level >= $maxlevel) {
|
if ($level >= $maxlevel) {
|
||||||
Logger::notice("Maximum level (".$maxlevel."%) of user connections reached: ".$used."/".$max);
|
Logger::warning("Maximum level (".$maxlevel."%) of user connections reached: ".$used."/".$max);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ class Worker
|
||||||
if ($level < $maxlevel) {
|
if ($level < $maxlevel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Logger::notice("Maximum level (".$level."%) of system connections reached: ".$used."/".$max);
|
Logger::warning("Maximum level (".$level."%) of system connections reached: ".$used."/".$max);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,7 +1352,7 @@ class Worker
|
||||||
$new_retrial = $retrial;
|
$new_retrial = $retrial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logger::info('New retrial for task', ['id' => $queue['id'], 'created' => $queue['created'], 'old' => $queue['retrial'], 'new' => $new_retrial]);
|
Logger::notice('New retrial for task', ['id' => $queue['id'], 'created' => $queue['created'], 'old' => $queue['retrial'], 'new' => $new_retrial]);
|
||||||
return $new_retrial;
|
return $new_retrial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1378,7 +1378,7 @@ class Worker
|
||||||
$new_retrial = self::getNextRetrial($queue, $max_level);
|
$new_retrial = self::getNextRetrial($queue, $max_level);
|
||||||
|
|
||||||
if ($new_retrial > $max_level) {
|
if ($new_retrial > $max_level) {
|
||||||
Logger::info('The task exceeded the maximum retry count', ['id' => $id, 'created' => $queue['created'], 'old_prio' => $queue['priority'], 'old_retrial' => $queue['retrial'], 'max_level' => $max_level, 'retrial' => $new_retrial]);
|
Logger::notice('The task exceeded the maximum retry count', ['id' => $id, 'created' => $queue['created'], 'old_prio' => $queue['priority'], 'old_retrial' => $queue['retrial'], 'max_level' => $max_level, 'retrial' => $new_retrial]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1490,12 +1490,12 @@ class Worker
|
||||||
*/
|
*/
|
||||||
private static function spawnDaemon()
|
private static function spawnDaemon()
|
||||||
{
|
{
|
||||||
Logger::info('Starting new daemon process');
|
Logger::notice('Starting new daemon process');
|
||||||
$command = 'bin/daemon.php';
|
$command = 'bin/daemon.php';
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
$process = new Core\Process(DI::logger(), DI::mode(), DI::config(), DI::modelProcess(), $a->getBasePath(), getmypid());
|
$process = new Core\Process(DI::logger(), DI::mode(), DI::config(), DI::modelProcess(), $a->getBasePath(), getmypid());
|
||||||
$process->run($command, ['start']);
|
$process->run($command, ['start']);
|
||||||
Logger::info('New daemon process started');
|
Logger::notice('New daemon process started');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user