From: Philipp Holzer Date: Thu, 28 Feb 2019 08:41:31 +0000 (+0100) Subject: Moving Profiling to class X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=25b6db6aca0180544f87fc251bdee5cb8266aff2;p=friendica.git Moving Profiling to class --- diff --git a/src/Core/Logger.php b/src/Core/Logger.php index 3cb22e1e47..fc2dde1dfe 100644 --- a/src/Core/Logger.php +++ b/src/Core/Logger.php @@ -4,14 +4,13 @@ */ namespace Friendica\Core; -use Friendica\BaseObject; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; /** * @brief Logger functions */ -class Logger extends BaseObject +class Logger { /** * @see Logger::error() @@ -96,13 +95,7 @@ class Logger extends BaseObject */ public static function emergency($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->emergency($message, $context); - self::getApp()->GetProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -120,13 +113,7 @@ class Logger extends BaseObject */ public static function alert($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->alert($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -143,13 +130,7 @@ class Logger extends BaseObject */ public static function critical($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->critical($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -165,14 +146,7 @@ class Logger extends BaseObject */ public static function error($message, $context = []) { - if (!isset(self::$logger)) { - echo "not set!?\n"; - return; - } - - $stamp1 = microtime(true); self::$logger->error($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -190,13 +164,7 @@ class Logger extends BaseObject */ public static function warning($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->warning($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -211,13 +179,7 @@ class Logger extends BaseObject */ public static function notice($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->notice($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -234,13 +196,7 @@ class Logger extends BaseObject */ public static function info($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->info($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -255,13 +211,7 @@ class Logger extends BaseObject */ public static function debug($message, $context = []) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->debug($message, $context); - self::getApp()->getProfiler()->saveTimestamp($stamp1, 'file', System::callstack()); } /** @@ -275,13 +225,7 @@ class Logger extends BaseObject */ public static function log($msg, $level = LogLevel::INFO) { - if (!isset(self::$logger)) { - return; - } - - $stamp1 = microtime(true); self::$logger->log($level, $msg); - self::getApp()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack()); } /** @@ -296,12 +240,10 @@ class Logger extends BaseObject */ public static function devLog($msg, $level = LogLevel::DEBUG) { - if (!isset(self::$logger)) { + if (!isset(self::$devLogger)) { return; } - $stamp1 = microtime(true); self::$devLogger->log($level, $msg); - self::getApp()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack()); } } diff --git a/src/Factory/DependencyFactory.php b/src/Factory/DependencyFactory.php index 9d84e324ab..67384452e9 100644 --- a/src/Factory/DependencyFactory.php +++ b/src/Factory/DependencyFactory.php @@ -30,7 +30,7 @@ class DependencyFactory $config = Factory\ConfigFactory::createConfig($configCache); // needed to call PConfig::init() Factory\ConfigFactory::createPConfig($configCache); - $logger = Factory\LoggerFactory::create($channel, $config); + $logger = Factory\LoggerFactory::create($channel, $config, $profiler); Factory\LoggerFactory::createDev($channel, $config); return new App($basePath, $config, $logger, $profiler, $isBackend); diff --git a/src/Factory/LoggerFactory.php b/src/Factory/LoggerFactory.php index f940d9d84c..ebcb3bd2b0 100644 --- a/src/Factory/LoggerFactory.php +++ b/src/Factory/LoggerFactory.php @@ -38,13 +38,14 @@ class LoggerFactory * * @param string $channel The channel of the logger instance * @param Configuration $config The config + * @param Profiler $profiler The profiler of the app * * @return LoggerInterface The PSR-3 compliant logger instance * * @throws \Exception * @throws InternalServerErrorException */ - public static function create($channel, Configuration $config) + public static function create($channel, Configuration $config, Profiler $profiler) { if (empty($config->get('system', 'debugging', false))) { $logger = new VoidLogger(); @@ -58,7 +59,7 @@ class LoggerFactory case 'syslog': $level = $config->get('system', 'loglevel'); - $logger = new SyslogLogger($channel, $introspection, $level); + $logger = new SyslogLogger($channel, $introspection, $profiler, $level); break; case 'monolog': default: diff --git a/src/Util/Logger/AbstractFriendicaLogger.php b/src/Util/Logger/AbstractFriendicaLogger.php new file mode 100644 index 0000000000..3f851f42de --- /dev/null +++ b/src/Util/Logger/AbstractFriendicaLogger.php @@ -0,0 +1,185 @@ +channel = $channel; + $this->introspection = $introspection; + $this->profiler = $profiler; + $this->logUid = Strings::getRandomHex(6); + } + + /** + * Simple interpolation of PSR-3 compliant replacements ( variables between '{' and '}' ) + * @see https://www.php-fig.org/psr/psr-3/#12-message + * + * @param string $message + * @param array $context + * + * @return string the interpolated message + */ + protected function psrInterpolate($message, array $context = array()) + { + $replace = []; + foreach ($context as $key => $value) { + // check that the value can be casted to string + if (!is_array($value) && (!is_object($value) || method_exists($value, '__toString'))) { + $replace['{' . $key . '}'] = $value; + } elseif (is_array($value)) { + $replace['{' . $key . '}'] = @json_encode($value); + } + } + + return strtr($message, $replace); + } + + /** + * {@inheritdoc} + */ + public function emergency($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::EMERGENCY, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function alert($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::ALERT, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function critical($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::CRITICAL, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function error($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::ERROR, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function warning($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::WARNING, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function notice($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::NOTICE, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function info($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::INFO, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function debug($message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry(LogLevel::DEBUG, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } + + /** + * {@inheritdoc} + */ + public function log($level, $message, array $context = array()) + { + $stamp1 = microtime(true); + $this->addEntry($level, $message, $context); + $this->profiler->saveTimestamp($stamp1, 'file', System::callstack()); + } +} diff --git a/src/Util/Logger/StreamLogger.php b/src/Util/Logger/StreamLogger.php index 7b9bbb3c1b..4ccbc8283b 100644 --- a/src/Util/Logger/StreamLogger.php +++ b/src/Util/Logger/StreamLogger.php @@ -2,300 +2,30 @@ namespace Friendica\Util\Logger; -use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Util\Introspection; -use Friendica\Util\Strings; -use Psr\Log\InvalidArgumentException; -use Psr\Log\LoggerInterface; -use Psr\Log\LogLevel; +use Friendica\Util\Profiler; /** * A Logger instance for logging into a stream - * @see http://php.net/manual/en/function.syslog.php */ -class StreamLogger implements LoggerInterface +class StreamLogger extends AbstractFriendicaLogger { - const IDENT = 'Friendica'; - - /** - * Translates LogLevel log levels to syslog log priorities. - * @var array - */ - private $logLevels = [ - LogLevel::DEBUG => LOG_DEBUG, - LogLevel::INFO => LOG_INFO, - LogLevel::NOTICE => LOG_NOTICE, - LogLevel::WARNING => LOG_WARNING, - LogLevel::ERROR => LOG_ERR, - LogLevel::CRITICAL => LOG_CRIT, - LogLevel::ALERT => LOG_ALERT, - LogLevel::EMERGENCY => LOG_EMERG, - ]; - - /** - * Translates log priorities to string outputs - * @var array - */ - private $logToString = [ - LOG_DEBUG => 'DEBUG', - LOG_INFO => 'INFO', - LOG_NOTICE => 'NOTICE', - LOG_WARNING => 'WARNING', - LOG_ERR => 'ERROR', - LOG_CRIT => 'CRITICAL', - LOG_ALERT => 'ALERT', - LOG_EMERG => 'EMERGENCY' - ]; - - /** - * The channel of the current process (added to each message) - * @var string - */ - private $channel; - - /** - * Indicates what logging options will be used when generating a log message - * @see http://php.net/manual/en/function.openlog.php#refsect1-function.openlog-parameters - * - * @var int - */ - private $logOpts; - - /** - * Used to specify what type of program is logging the message - * @see http://php.net/manual/en/function.openlog.php#refsect1-function.openlog-parameters - * - * @var int - */ - private $logFacility; - - /** - * The minimum loglevel at which this logger will be triggered - * @var int - */ - private $logLevel; - - /** - * The Introspection for the current call - * @var Introspection - */ - private $introspection; - - /** - * The UID of the current call - * @var string - */ - private $logUid; - - /** - * @param string $channel The output channel - * @param Introspection $introspection The introspection of the current call - * @param string $level The minimum loglevel at which this logger will be triggered - * @param int $logOpts Indicates what logging options will be used when generating a log message - * @param int $logFacility Used to specify what type of program is logging the message - * - * @throws \Exception - */ - public function __construct($channel, Introspection $introspection, $level = LogLevel::NOTICE, $logOpts = LOG_PID, $logFacility = LOG_USER) - { - $this->logUid = Strings::getRandomHex(6); - $this->channel = $channel; - $this->logOpts = $logOpts; - $this->logFacility = $logFacility; - $this->logLevel = $this->mapLevelToPriority($level); - $this->introspection = $introspection; - } - - /** - * Maps the LogLevel (@see LogLevel ) to a SysLog priority (@see http://php.net/manual/en/function.syslog.php#refsect1-function.syslog-parameters ) - * - * @param string $level A LogLevel - * - * @return int The SysLog priority - * - * @throws \Psr\Log\InvalidArgumentException If the loglevel isn't valid - */ - public function mapLevelToPriority($level) - { - if (!array_key_exists($level, $this->logLevels)) { - throw new InvalidArgumentException('LogLevel \'' . $level . '\' isn\'t valid.'); - } - - return $this->logLevels[$level]; - } - - /** - * Writes a message to the syslog - * @see http://php.net/manual/en/function.syslog.php#refsect1-function.syslog-parameters - * - * @param int $priority The Priority - * @param string $message The message of the log - * - * @throws InternalServerErrorException if syslog cannot be used - */ - private function write($priority, $message) - { - if (!openlog(self::IDENT, $this->logOpts, $this->logFacility)) { - throw new InternalServerErrorException('Can\'t open syslog for ident "' . $this->channel . '" and facility "' . $this->logFacility . '""'); - } - - syslog($priority, $message); - } - - /** - * Closes the Syslog - */ - public function close() - { - closelog(); - } - - /** - * Formats a log record for the syslog output - * - * @param int $level The loglevel/priority - * @param string $message The message - * @param array $context The context of this call - * - * @return string the formatted syslog output - */ - private function formatLog($level, $message, $context = []) + public function __construct($channel, Introspection $introspection, Profiler $profiler) { - $record = $this->introspection->getRecord(); - $record = array_merge($record, ['uid' => $this->logUid]); - $logMessage = ''; - - $logMessage .= $this->channel . ' '; - $logMessage .= '[' . $this->logToString[$level] . ']: '; - $logMessage .= $this->psrInterpolate($message, $context) . ' '; - $logMessage .= @json_encode($context) . ' - '; - $logMessage .= @json_encode($record); - - return $logMessage; + parent::__construct($channel, $introspection, $profiler); } /** - * Simple interpolation of PSR-3 compliant replacements ( variables between '{' and '}' ) - * @see https://www.php-fig.org/psr/psr-3/#12-message + * Adds a new entry to the log * + * @param int $level * @param string $message - * @param array $context + * @param array $context * - * @return string the interpolated message - */ - private function psrInterpolate($message, array $context = array()) - { - $replace = []; - foreach ($context as $key => $value) { - // check that the value can be casted to string - if (!is_array($value) && (!is_object($value) || method_exists($value, '__toString'))) { - $replace['{' . $key . '}'] = $value; - } elseif (is_array($value)) { - $replace['{' . $key . '}'] = @json_encode($value); - } - } - - return strtr($message, $replace); - } - - /** - * Adds a new entry to the syslog - * - * @param int $level - * @param string $message - * @param array $context - * - * @throws InternalServerErrorException if the syslog isn't available - */ - private function addEntry($level, $message, $context = []) - { - if ($level >= $this->logLevel) { - return; - } - - $formattedLog = $this->formatLog($level, $message, $context); - $this->write($level, $formattedLog); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function emergency($message, array $context = array()) - { - $this->addEntry(LOG_EMERG, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function alert($message, array $context = array()) - { - $this->addEntry(LOG_ALERT, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function critical($message, array $context = array()) - { - $this->addEntry(LOG_CRIT, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function error($message, array $context = array()) - { - $this->addEntry(LOG_ERR, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function warning($message, array $context = array()) - { - $this->addEntry(LOG_WARNING, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function notice($message, array $context = array()) - { - $this->addEntry(LOG_NOTICE, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function info($message, array $context = array()) - { - $this->addEntry(LOG_INFO, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function debug($message, array $context = array()) - { - $this->addEntry(LOG_DEBUG, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available + * @return void */ - public function log($level, $message, array $context = array()) + protected function addEntry($level, $message, $context = []) { - $logLevel = $this->mapLevelToPriority($level); - $this->addEntry($logLevel, $message, $context); + // TODO: Implement addEntry() method. } } diff --git a/src/Util/Logger/SyslogLogger.php b/src/Util/Logger/SyslogLogger.php index 5cb1f8c9e6..25d8f2f5e2 100644 --- a/src/Util/Logger/SyslogLogger.php +++ b/src/Util/Logger/SyslogLogger.php @@ -4,16 +4,15 @@ namespace Friendica\Util\Logger; use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Util\Introspection; -use Friendica\Util\Strings; +use Friendica\Util\Profiler; use Psr\Log\InvalidArgumentException; -use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; /** * A Logger instance for syslogging (fast, but simple) * @see http://php.net/manual/en/function.syslog.php */ -class SyslogLogger implements LoggerInterface +class SyslogLogger extends AbstractFriendicaLogger { const IDENT = 'Friendica'; @@ -47,12 +46,6 @@ class SyslogLogger implements LoggerInterface LOG_EMERG => 'EMERGENCY' ]; - /** - * The channel of the current process (added to each message) - * @var string - */ - private $channel; - /** * Indicates what logging options will be used when generating a log message * @see http://php.net/manual/en/function.openlog.php#refsect1-function.openlog-parameters @@ -76,34 +69,20 @@ class SyslogLogger implements LoggerInterface private $logLevel; /** - * The Introspection for the current call - * @var Introspection - */ - private $introspection; - - /** - * The UID of the current call - * @var string - */ - private $logUid; - - /** - * @param string $channel The output channel - * @param Introspection $introspection The introspection of the current call + * {@inheritdoc} * @param string $level The minimum loglevel at which this logger will be triggered * @param int $logOpts Indicates what logging options will be used when generating a log message * @param int $logFacility Used to specify what type of program is logging the message * * @throws \Exception */ - public function __construct($channel, Introspection $introspection, $level = LogLevel::NOTICE, $logOpts = LOG_PID, $logFacility = LOG_USER) + public function __construct($channel, Introspection $introspection, Profiler $profiler, $level = LogLevel::NOTICE, $logOpts = LOG_PID, $logFacility = LOG_USER) { - $this->logUid = Strings::getRandomHex(6); - $this->channel = $channel; + parent::__construct($channel, $introspection, $profiler); $this->logOpts = $logOpts; $this->logFacility = $logFacility; $this->logLevel = $this->mapLevelToPriority($level); - $this->introspection = $introspection; + $this->introspection->addClasses(array(self::class)); } /** @@ -174,30 +153,6 @@ class SyslogLogger implements LoggerInterface return $logMessage; } - /** - * Simple interpolation of PSR-3 compliant replacements ( variables between '{' and '}' ) - * @see https://www.php-fig.org/psr/psr-3/#12-message - * - * @param string $message - * @param array $context - * - * @return string the interpolated message - */ - private function psrInterpolate($message, array $context = array()) - { - $replace = []; - foreach ($context as $key => $value) { - // check that the value can be casted to string - if (!is_array($value) && (!is_object($value) || method_exists($value, '__toString'))) { - $replace['{' . $key . '}'] = $value; - } elseif (is_array($value)) { - $replace['{' . $key . '}'] = @json_encode($value); - } - } - - return strtr($message, $replace); - } - /** * Adds a new entry to the syslog * @@ -207,95 +162,15 @@ class SyslogLogger implements LoggerInterface * * @throws InternalServerErrorException if the syslog isn't available */ - private function addEntry($level, $message, $context = []) + protected function addEntry($level, $message, $context = []) { - if ($level >= $this->logLevel) { + $logLevel = $this->mapLevelToPriority($level); + + if ($logLevel >= $this->logLevel) { return; } $formattedLog = $this->formatLog($level, $message, $context); $this->write($level, $formattedLog); } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function emergency($message, array $context = array()) - { - $this->addEntry(LOG_EMERG, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function alert($message, array $context = array()) - { - $this->addEntry(LOG_ALERT, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function critical($message, array $context = array()) - { - $this->addEntry(LOG_CRIT, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function error($message, array $context = array()) - { - $this->addEntry(LOG_ERR, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function warning($message, array $context = array()) - { - $this->addEntry(LOG_WARNING, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function notice($message, array $context = array()) - { - $this->addEntry(LOG_NOTICE, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function info($message, array $context = array()) - { - $this->addEntry(LOG_INFO, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function debug($message, array $context = array()) - { - $this->addEntry(LOG_DEBUG, $message, $context); - } - - /** - * {@inheritdoc} - * @throws InternalServerErrorException if the syslog isn't available - */ - public function log($level, $message, array $context = array()) - { - $logLevel = $this->mapLevelToPriority($level); - $this->addEntry($logLevel, $message, $context); - } } diff --git a/tests/include/ApiTest.php b/tests/include/ApiTest.php index 2f8becc18c..394e822201 100644 --- a/tests/include/ApiTest.php +++ b/tests/include/ApiTest.php @@ -43,7 +43,7 @@ class ApiTest extends DatabaseTest Factory\DBFactory::init($basePath, $configCache, $profiler, $_SERVER); $config = Factory\ConfigFactory::createConfig($configCache); Factory\ConfigFactory::createPConfig($configCache); - $logger = Factory\LoggerFactory::create('test', $config); + $logger = Factory\LoggerFactory::create('test', $config, $profiler); $this->app = new App($basePath, $config, $logger, $profiler, false); parent::setUp(); diff --git a/tests/src/Database/DBATest.php b/tests/src/Database/DBATest.php index 511821da57..1408fc37bd 100644 --- a/tests/src/Database/DBATest.php +++ b/tests/src/Database/DBATest.php @@ -20,7 +20,7 @@ class DBATest extends DatabaseTest Factory\DBFactory::init($basePath, $configCache, $profiler, $_SERVER); $config = Factory\ConfigFactory::createConfig($configCache); Factory\ConfigFactory::createPConfig($configCache); - $logger = Factory\LoggerFactory::create('test', $config); + $logger = Factory\LoggerFactory::create('test', $config, $profiler); $this->app = new App($basePath, $config, $logger, $profiler, false); parent::setUp(); diff --git a/tests/src/Database/DBStructureTest.php b/tests/src/Database/DBStructureTest.php index 7b1ff2a31f..0efecac234 100644 --- a/tests/src/Database/DBStructureTest.php +++ b/tests/src/Database/DBStructureTest.php @@ -20,7 +20,7 @@ class DBStructureTest extends DatabaseTest Factory\DBFactory::init($basePath, $configCache, $profiler, $_SERVER); $config = Factory\ConfigFactory::createConfig($configCache); Factory\ConfigFactory::createPConfig($configCache); - $logger = Factory\LoggerFactory::create('test', $config); + $logger = Factory\LoggerFactory::create('test', $config, $profiler); $this->app = new App($basePath, $config, $logger, $profiler, false); parent::setUp();