EasyCorp/easy-log-handler

Can logs be rotated using this bundle?

reypm opened this issue · 3 comments

reypm commented

I am wondering if is there any way to rotate logs when I am using this bundle since I'd to get rid of the default config .... maybe this isn't necessary but was the only way to make it work. This is how my setup looks like:

 monolog:
    handlers:
        #main:
        #    type: stream
        #    path: "%kernel.logs_dir%/%kernel.environment%.log"
        #    level: debug
        #    channels: [!event]
        console:
            type:   console
            channels: [!event, !doctrine]
        buffered:
            type:     buffer
            handler:  easylog
            channels: ["!event"]
            level:    debug
        easylog:
            type: service
            id:   easycorp.easylog.handler
        # uncomment to get logging in your browser
        # you may have to allow bigger header sizes in your Web server configuration
        #firephp:
        #    type:   firephp
        #    level:  info
        #chromephp:
        #    type:   chromephp
        #    level:  info

Can I rotate logs? How?

There is no way to rotate log files with this project, because this is just a handler for Monolog, so it just formats the messages before logging them. In any case, I agree with you and I'd like to have something pre-configured in Symfony about this because log files can grow a lot.

So this is a feature request. Why is this issue closed? Right now the handler use StreamHandler we could use RotatingFileHandler?

It was a while and I did not check if that was the case for Monolog 1.x, but in Monolog 2.x it looks possible to change the design of EasyLogHandler and instead leveraging the FormattableHandlerInterface to be able to manipulate any kind of handler as opposed to extend the StreamHandler