diff --git a/src/Core/Worker.php b/src/Core/Worker.php index d7133c0b7a..faa29717c1 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -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; diff --git a/src/DI.php b/src/DI.php index b758ddab0b..692d87870d 100644 --- a/src/DI.php +++ b/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 */ diff --git a/static/dependencies.config.php b/static/dependencies.config.php index 46463de61e..d3034a2ba5 100644 --- a/static/dependencies.config.php +++ b/static/dependencies.config.php @@ -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;