Seldaek/monolog · error · InvalidArgumentException
Invalid filename format - format must contain at least `{dat
Error message
Invalid filename format - format must contain at least `{date}`, because otherwise rotating is impossible. What it means
Error "Invalid filename format - format must contain at least `{date}`, because otherwise rotating is impossible." thrown in Seldaek/monolog.
Source
Thrown at src/Monolog/Handler/RotatingFileHandler.php:87
}
}
/**
* @inheritDoc
*/
public function reset(): void
{
parent::reset();
}
/**
* @return $this
*/
public function setFilenameFormat(string $filenameFormat, string $dateFormat): self
{
$this->setDateFormat($dateFormat);
if (substr_count($filenameFormat, '{date}') === 0) {
throw new InvalidArgumentException(
'Invalid filename format - format must contain at least `{date}`, because otherwise rotating is impossible.'
);
}
$this->filenameFormat = $filenameFormat;
$this->url = $this->getTimedFilename();
$this->close();
return $this;
}
/**
* @inheritDoc
*/
protected function write(LogRecord $record): void
{
// on the first record written, if the log is new, we rotate (once per day) after the log has been written so that the new file exists
if (null === $this->mustRotate) {
$this->mustRotate = null === $this->url || !file_exists($this->url);View on GitHub (pinned to 57eb102834)
When it happens
Trigger: Thrown at src/Monolog/Handler/RotatingFileHandler.php:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Seldaek/monolog@57eb102834 (2026-08-17).
Data as JSON: /api/errors/7adb47b523734508.
Report an issue: GitHub.