Issue 9704: Improved log levels
This commit is contained in:
parent
54db693e16
commit
d1ea529cfb
|
@ -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 a new issue