Configuring Multiple Laravel Log Files

Recently I wanted to split out log files depending on the severity level however it was a bit trickier than I expected. The official docs mention configuring Monolog but don’t provide much detail. I’ve not used the package before and hunting around the docs and Google didn’t give me much to go on and confused me.

I initially just wanted to log info levels to a separate file, thinking it would be as simple as pushing a handler with just the INFO constant that unfortunately didn’t work. Things bubble up so info & above were being caught — adding in the false 3rd param didn’t have any affect.

So below you can see I’ve added DEBUG to info.log and NOTICE to laravel.log. DEBUG & INFO get caught by the 1st and go to info.log and the rest get caught by the 2nd and go to laravel.log.