Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Slothlike's avatar

Console Command and Jobs unable to Log to Slack

In my development environment (Still on Laravel 8), if I use Log::channel('slack')->critical('Test the message works') within a request it works fine.

Route::get('/test', function(){
    Log::channel('slack-queue-logging')->critical('Test message from web.php');
});

However, if I use it from the console or within a scheduled job it doesn't work.

public function handle()
{
    Log::channel('slack-queue-logging')->critical('Test message from console');
    return 0;
}

Log isn't the only thing that behaves this way, I have a service provider that doesn't seem to want to work either. So when I want to use a custom database connection using this service provider it fails when using the console or scheduled jobs.

// This will work in a route but not in a console command or scheduled job
$quotes = Quote::on('openedge')
               ->where('enter_date', Carbon::today())
               ->get();

The errors haven't helped me.

RuntimeException: Curl error (code 60): SSL certificate problem: unable to get local issuer certificate in ......\vendor\monolog\monolog\src\Monolog\Handler\Curl\Util.php:56

Database provider

PDOException could not find driver at ......\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

But why isn't this a problem when using a normal request?

I hope it is something really simple I've missed. I'm not even sure what part of the documentation to pour over to find a solution.

0 likes
0 replies

Please or to participate in this conversation.