1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00

Canonicalize paths when constructing RotatingFileHandler/StreamHandler, fixes #1326

This commit is contained in:
Jordi Boggiano
2020-05-21 16:54:57 +02:00
parent acd3173c4a
commit c50950d79e
4 changed files with 57 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Utils;
/**
* Stores logs to files that are rotated every day and a limited number of files are kept.
@@ -45,7 +46,7 @@ class RotatingFileHandler extends StreamHandler
*/
public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false)
{
$this->filename = $filename;
$this->filename = Utils::canonicalizePath($filename);
$this->maxFiles = (int) $maxFiles;
$this->nextRotation = new \DateTime('tomorrow');
$this->filenameFormat = '{filename}-{date}';