Published on

How to get laravel Logs in instantly in Slack Channel

  • avatar
    Md Rathik
laravel logs into Slack

When you have an laravel application with many users & get report frequently about error. So in that case you have to check the logs mannully and fix the issues of user. But before get a complain from user you have the opportunity to know where issue/error triggerd, that would be great. WSo i will help you to know when any error trigger on your application, the error log automatically send to your slack channel.

Step 1 : Create a webhook URL on slack

For this you need to go and select create an app option. Please enter your app name (anything) and select the slack workspace.

create slack app

Step 2 : Select Incoming webhook and Turn on

Turn on the slack webhook service and you will get option below the page to add your app into channel where you want to get the notication.

create slack app
create slack app

Step 3 : Test the webhook URL

Now you will get a webhook url and CURL command to test. So before setup into laravel you can copy the curl code and paste into Termial to check.

create slack app
create slack app

Step 4 : setup .env

Just go into your laravel project and setup the .env files like this.

create slack app

Step 4 : Test from your application

This time, you can produce a error, then you will see that application automatically send the error logs to your slack.

create slack app