I found some outdated libraries and complicated ways to do this. So I ended up with a very simple solution. In fact, the Laravel Monolog Handler already has a Loggly handler out of the box.
Add configuration information to config / services.php:
'loggly' => array(
'key' => 'ENTER_YOUR_LOGGLY_TOKEN_HERE',
'tag' => 'ProjectName_' .strtolower(env('APP_ENV')),
),
Then add the Monolog handler to bootstrap / app.php, before returning $ app:
$app->configureMonologUsing(function($monolog) {
$handler = new \Monolog\Handler\LogglyHandler(config('services.loggly.key'),\Monolog\Logger::DEBUG);
$handler->setTag(config('services.loggly.tag'));
$monolog->pushHandler($handler);
});
Voila! You get your Monolog logs in the Loggly toolbar.
source
share