I tried to use logrotate with the single log file, but after logrotate ran all my jobs except one stopped adding lines in the log file. And yes I did add the right filepermissions in the logrotate config.
Anyone has a suggestion how I can best achieve this?
Thanks guys, I already found the daily option but with the daily option today's logfile name is not laravel.log but has today's date. Is there any way to override that so it will be just laravel.log for todays logs?
@hsl Looking at the source of Monolog's RotatingFileHandler it doesn't seem to be an option out of the box. It always creates file names with the date appended.
@martinbean Sorry for the late reply, but I want that because I want to be able to leave a tail -f laravel.log open on my server.
I fixed it by just using logrotate logrotate and use that to keep the log files for a week, todays log file is always laravel.log, yesterdays log file is laravel.log.1 and so on. :)
Yeah, I agree that the option of using "daily" isn't ideal since you then no longer have a log file with a simple static name so you can always read from it in the same place. So for now, configuring logrotate appears to be the best option for most of us.
For most servers with logrotate, the way you do that is by creating a file in /etc/logrotate.d such as "/etc/logrotate.d/laravel" with something similar to this:
Using logrotate or any other outta Laravel is just a work around. What if you use a multi-user environment with multiple dirs and so different storage/logs files ? Surely a slightly more complex config should fit, but Laravel should manage its own log rotation.
Modifying function rotate of RotatingFileHandler.php should be the fix. I'll tell if I get it
I have a project in laravel 4. And I don't see any 'log' 'log_max_files' option in app/config/app.php. How do I configure log rotation in laravel 4. It is 4.1.* if it helps.
I'm late here, but there is no reason why a symbolic link could not be used to point laravel.log to the latest named log file when it gets created, i.e. as a part of the rotation. That should involve minimum effort for a handy feature.