Adds DI::flushLogger() to renew Logger instances
This commit is contained in:
parent
7637ae1dcc
commit
32f0c3fb9c
|
@ -1182,7 +1182,7 @@ class Worker
|
|||
// We now are in the new worker
|
||||
DBA::connect();
|
||||
|
||||
/// @todo Reinitialize the logger to set a new process_id and uid
|
||||
DI::flushLogger();
|
||||
$process = DI::process()->create($pid);
|
||||
|
||||
$cycles = 0;
|
||||
|
|
12
src/DI.php
12
src/DI.php
|
@ -230,6 +230,18 @@ abstract class DI
|
|||
// "LoggerInterface" instances
|
||||
//
|
||||
|
||||
/**
|
||||
* Flushes the Logger instance, so the factory is called again
|
||||
* (creates a new id and retrieves the current PID)
|
||||
*/
|
||||
public static function flushLogger()
|
||||
{
|
||||
$flushDice = self::$dice
|
||||
->addRule(LoggerInterface::class, self::$dice->getRule(LoggerInterface::class))
|
||||
->addRule('$devLogger', self::$dice->getRule('$devLogger'));
|
||||
static::init($flushDice);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,6 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Lock;
|
||||
use Friendica\Core\Process;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\Core\Storage\Repository\StorageManager;
|
||||
use Friendica\Database\Database;
|
||||
|
|
Loading…
Reference in New Issue
Block a user