in joomla 3.x (but this is also true for joomla 4.x) we faced the problem of registering our loggers. there the namespace is rigidly tied to the kernel, that is, we cannot register our loggers at all. We had to make our layer MyLog extends Log and override the addLogEntry method
In code: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Log/Log.php#L355
How can this be solved?
We decided in our own way, but I'll write about what can be done here.
if(class_exists($this->configurations[$signature]['logger']))
{
$class = $this->configurations[$signature]['logger'];
}
else
{
$class = __NAMESPACE__ . '\\Logger\\' . ucfirst($this->configurations[$signature]['logger']) . 'Logger';
if (!class_exists($class))
{
throw new \RuntimeException('Unable to create a Logger instance: ' . $class);
}
}
A similar problem applies to registering your Storage classes for Cache: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Cache/CacheStorage.php#L149
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
bug
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-03-09 15:20:51 |
Closed_By | ⇒ | Fedik |
@Hackwar You can close this issue. Now you can registry your own logger
joomla-cms/libraries/src/Log/LoggerRegistry.php
Line 84 in e462044