{"record":{"id":"09e32f8926e22cd9","repo":"Seldaek/monolog","slug":"invalid-date-format-format-must-be-one-of-rotati","errorCode":null,"errorMessage":"Invalid date format - format must be one of RotatingFileHandler::FILE_PER_HOUR (\"Y-m-d-H\"), RotatingFileHandler::FILE_PER_DAY (\"Y-m-d\"), RotatingFileHandler::FILE_PER_MONTH (\"Y-m\") or RotatingFileHandler::FILE_PER_YEAR (\"Y\"), or you can set one of the date formats using slashes, underscores and/or dots instead of dashes.","messagePattern":"Invalid date format - format must be one of RotatingFileHandler::FILE_PER_HOUR \\(\"Y-m-d-H\"\\), RotatingFileHandler::FILE_PER_DAY \\(\"Y-m-d\"\\), RotatingFileHandler::FILE_PER_MONTH \\(\"Y-m\"\\) or RotatingFileHandler::FILE_PER_YEAR \\(\"Y\"\\), or you can set one of the date formats using slashes, underscores and/or dots instead of dashes\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/RotatingFileHandler.php","lineNumber":217,"sourceCode":"            ['{filename}', '{date}'],\n            [$fileInfo['filename'], str_replace(\n                ['Y', 'y', 'm', 'd', 'H'],\n                ['[0-9][0-9][0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]'],\n                $this->dateFormat\n            )],\n            ($fileInfo['dirname'] ?? '') . '/' . $this->filenameFormat\n        );\n        if (isset($fileInfo['extension'])) {\n            $glob .= '.'.$fileInfo['extension'];\n        }\n\n        return $glob;\n    }\n\n    protected function setDateFormat(string $dateFormat): void\n    {\n        if (0 === preg_match('{^[Yy](([/_.-]?m)([/_.-]?d([/_.-]?H)?)?)?$}', $dateFormat)) {\n            throw new InvalidArgumentException(\n                'Invalid date format - format must be one of RotatingFileHandler::FILE_PER_HOUR (\"Y-m-d-H\"), '.\n                'RotatingFileHandler::FILE_PER_DAY (\"Y-m-d\"), RotatingFileHandler::FILE_PER_MONTH (\"Y-m\") '.\n                'or RotatingFileHandler::FILE_PER_YEAR (\"Y\"), or you can set one of the '.\n                'date formats using slashes, underscores and/or dots instead of dashes.'\n            );\n        }\n\n        $this->dateFormat = $dateFormat;\n    }\n\n    protected function getNextRotation(): \\DateTimeImmutable\n    {\n        return match (str_replace(['/','_','.'], '-', $this->dateFormat)) {\n            self::FILE_PER_MONTH => (new \\DateTimeImmutable('first day of next month', $this->timezone))->setTime(0, 0, 0),\n            self::FILE_PER_YEAR => (new \\DateTimeImmutable('first day of January next year', $this->timezone))->setTime(0, 0, 0),\n            default => (new \\DateTimeImmutable('tomorrow', $this->timezone))->setTime(0, 0, 0),\n        };\n    }","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/RotatingFileHandler.php#L199-L235","documentation":"Error \"Invalid date format - format must be one of RotatingFileHandler::FILE_PER_HOUR (\"Y-m-d-H\"), RotatingFileHandler::FILE_PER_DAY (\"Y-m-d\"), RotatingFileHandler::FILE_PER_MONTH (\"Y-m\") or RotatingFileHandler::FILE_PER_YEAR (\"Y\"), or you can set one of the date formats using slashes, underscores and/or dots instead of dashes.\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/RotatingFileHandler.php:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}