Skip to content

Configuration of "main" log / No rotation #1962

Open
@micter59

Description

@micter59

PHP 8.2
Symfony 7.2.3
Monolog 3.10.0

Hello, I'm using monolog with Symfony.
I configured the "main" log for rotation, but it seems rotation never happens.
Here's the config I put in monolog.yaml to configure the service :

when@dev:
    monolog:
        handlers:
            main:
                type: rotating_file
                path: "%kernel.logs_dir%/%kernel.environment%_main.log"
                level: debug
                channels: [ "!security", "!audit" ]
                max_files: 30
            security:
                type: rotating_file
                path: "%kernel.logs_dir%/%kernel.environment%_security.log"
                level: debug
                channels: [ "security" ]
                max_files: 10
            audit:
                type: rotating_file
                path: "%kernel.logs_dir%/%kernel.environment%_audit.log"
                level: debug
                channels: [ "audit" ]
                max_files: 10

For security and audit handlers, everything is ok. I've got log files each day, with names like "dev_audit-YYYY-MM-DD.log" or "dev_security-YYYY-MM-DD.log". Same configuration is done for "main" handler, but the logs never rotates. And I saw that the log file is called "dev.log", and not "dev_main.log" as configured.

Do you see anything I missed in the configuration please ?

Thank you.

Michaël

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions