diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-12-05 19:54:37 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2022-12-19 13:28:13 +0000 |
commit | bba890822b195521ce2380a5d01e33ba5a15aae8 (patch) | |
tree | ae909360ea6804ffcf01367168e7d16a602438de /lib/private/Log | |
parent | 1efbbd885c628c1f4cc777479988e0a10427f4e1 (diff) | |
download | nextcloud-server-bba890822b195521ce2380a5d01e33ba5a15aae8.tar.gz nextcloud-server-bba890822b195521ce2380a5d01e33ba5a15aae8.zip |
fix(logging): Fix array to string conversion in errorlog writer
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Log')
-rw-r--r-- | lib/private/Log/Errorlog.php | 10 | ||||
-rw-r--r-- | lib/private/Log/LogFactory.php | 4 | ||||
-rw-r--r-- | lib/private/Log/Syslog.php | 2 | ||||
-rw-r--r-- | lib/private/Log/Systemdlog.php | 2 |
4 files changed, 10 insertions, 8 deletions
diff --git a/lib/private/Log/Errorlog.php b/lib/private/Log/Errorlog.php index d27759d7050..20a3ec9e296 100644 --- a/lib/private/Log/Errorlog.php +++ b/lib/private/Log/Errorlog.php @@ -25,9 +25,10 @@ namespace OC\Log; +use OC\SystemConfig; use OCP\Log\IWriter; -class Errorlog implements IWriter { +class Errorlog extends LogDetails implements IWriter { /** @var string */ protected $tag; @@ -37,12 +38,13 @@ class Errorlog implements IWriter { } /** - * write a message in the log + * Write a message in the log + * * @param string $app - * @param string $message + * @param string|array $message * @param int $level */ public function write(string $app, $message, int $level) { - error_log('[' . $this->tag . ']['.$app.']['.$level.'] '.$message); + error_log('[' . $this->tag . ']['.$app.']['.$level.'] '.$this->logDetailsAsJSON($app, $message, $level)); } } diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php index 807ff501e39..2fdadc3bdb2 100644 --- a/lib/private/Log/LogFactory.php +++ b/lib/private/Log/LogFactory.php @@ -49,7 +49,7 @@ class LogFactory implements ILogFactory { public function get(string $type):IWriter { switch (strtolower($type)) { case 'errorlog': - return new Errorlog(); + return new Errorlog($this->systemConfig); case 'syslog': return $this->c->resolve(Syslog::class); case 'systemd': @@ -73,7 +73,7 @@ class LogFactory implements ILogFactory { protected function createNewLogger(string $type, string $tag, string $path): IWriter { switch (strtolower($type)) { case 'errorlog': - return new Errorlog($tag); + return new Errorlog($this->systemConfig, $tag); case 'syslog': return new Syslog($this->systemConfig, $tag); case 'systemd': diff --git a/lib/private/Log/Syslog.php b/lib/private/Log/Syslog.php index 8140b4ec77c..f4ba857742f 100644 --- a/lib/private/Log/Syslog.php +++ b/lib/private/Log/Syslog.php @@ -53,7 +53,7 @@ class Syslog extends LogDetails implements IWriter { /** * write a message in the log * @param string $app - * @param string $message + * @param string|array $message * @param int $level */ public function write(string $app, $message, int $level) { diff --git a/lib/private/Log/Systemdlog.php b/lib/private/Log/Systemdlog.php index 00f242e3718..20a60623713 100644 --- a/lib/private/Log/Systemdlog.php +++ b/lib/private/Log/Systemdlog.php @@ -72,7 +72,7 @@ class Systemdlog extends LogDetails implements IWriter { /** * Write a message to the log. * @param string $app - * @param string $message + * @param string|array $message * @param int $level */ public function write(string $app, $message, int $level) { |