Stubbs's avatar
Level 1

Logging to Discord

I want to set up a logging channel to log critical errors to Discord using the Slack driver, you just add /slack to the end of the webhook to use Slack syntax). LOG_DISCORD_WEBHOOK_URL is set in my environment and I've tested the URL works via Postman.

The config in logging.php looks like this:

        'discord' => [
            'driver' => 'slack',
            'url' => env('LOG_DISCORD_WEBHOOK_URL'),
            'username' => 'Brick',
            'emoji' => ':boom:',
            'level' => 'critical',
        ],

and it's added to the stack channel

        'stack' => [
            'driver' => 'stack',
            'channels' => ['daily', 'discord', 'stderr'],
            'ignore_exceptions' => false,
        ],

I never seem to get any errors in the channel, even though I know there are quite a few, I can't even force any logging by using Log::channel('discord')->critical('This is a test')

I'm a bit stuck really.

0 likes
0 replies

Please or to participate in this conversation.