monolog-bundle
monolog-bundle copied to clipboard
max_files configuration for rotating_file handler ignored
We have noticed an issue with the following configuration:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: rotating_file
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
max_files: 10
console:
type: console
The logs are rotated fine but older files are not cleaned up. In effect, it is like max_files
is completely ignored.
Symfony Version: 3.4 Monolog Bundle Version: ^3.0.2
Please let me know whether this is expected or an issue.
It looks to me as if the option is passed to the handler, see MonologExtension.php#L395-L401. Are you sure this is not an issue with the handler itself or your setup, e.g. due to file permissions? If it's an issue with the handler you should consider opening an issue with seldaek/monolog instead.
It looks to me as if the option is passed to the handler, see MonologExtension.php#L395-L401. Are you sure this is not an issue with the handler itself or your setup, e.g. due to file permissions? If it's an issue with the handler you should consider opening an issue with seldaek/monolog instead.
I doubt it's a permission issue since new files are being created daily. Just to verify, what is the expected permission level ?
Any updates here ?
I have a Symfony 4.4-project which uses the rotating_file
-handler for the dev environment and it works as expected, i.e. it keeps as many files as I specify in the config and does not touch files that were not created by it in the same folder, e.g. a separate error.log
. There is not much else I can do, unless you can provide a demo-app which reproduces your problem.