Reputation: 3203
I'm looking for solution of multiple log files on Laravel 4.2.
Right now, I'm using Laravel default setup which is log to laravel.log
by Log::error($exception);
.
I need a way to be able write to laravel.log
file and add ability to write also to mycustom.log
some of special errors which is more critical to me and i would like to classify in another log file.
Thanks :)
Upvotes: 1
Views: 2422
Reputation: 8151
A simple solution would be to register a log listener and do the saving yourself into mycustom.log
if it matches your criteria. You can send additional data in the log $context
variable.
Log::listen(function($level, $message, $context)
{
// Save to mycustom.log
});
Laravel uses the Monolog logging library which contains plenty of other features though that you might want to look into. You can get an instance of Monolog by doing Log::getMonolog()
.
Upvotes: 2