5 years ago

L5 Monolog with Slack integration

Posted 5 years ago by khoanguyenme

I'm using Monolog with ChromePHP and now I want to integrate it with Slack but I can't config SlackHandler to works. In app\Providers\AppServiceProviders.php:

<?php namespace Quiz\Providers;

use Illuminate\Support\ServiceProvider;
use Log;

class AppServiceProvider extends ServiceProvider {

     * Bootstrap any application services.
     * @return void
    public function boot()
            $monolog = Log::getMonolog();

            if (env('APP_ENV') === 'local')
                $monolog->pushHandler($chromeHandler = new \Monolog\Handler\ChromePHPHandler());
                $chromeHandler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());

            $slackHandler = new \Monolog\Handler\SlackHandler(
            $slackHandler->setFormatter(new \Monolog\Formatter\LineFormatter());


I get my-api-token at Try to log somethings but only ChromePHP (and of course default Laravel file log works).

Is there anything wrong with my config? I also open a issue on Monolog's github but no response yet.

Please sign in or create an account to participate in this conversation.