Laravel 8 Logs Management with Example —

This tutorial help to understand laravel 8 logging. The logging help to understand what’s happening into your application. You can also identify the error line with correct understandable exception message.

We will create different types of logs message into the log file. You can view the logs message into log file, see into the shell command window.

Laravel Log

The default channel is log file and stored into the /storage/logs/laravel.log file. The Laravel provides robust logging services that allow you to log messages to files, the system error log, and even to Slack to notify your entire team.

Laravel logs is depend on channel, You can defined channel information into the config/logging.php configuration file. The Log messages may be written to multiple channels based on their severity. By default, Laravel will use the stack channel when logging messages.

Each channel writes log information a specific way, Like the single channel writes log files to a single log file, while the slack channel sends log messages to Slack.

How To Configuring The Channel Name

The laravel log internally utilizes the Monolog library, That provides support for a variety of powerful log handlers.

There is a following sample channel configuration :

Where params are :

  • driver : The driver determines how and where the log message is actually recorded.
  • name : This is your channel name.
  • channels : array of channels.

There are following channels available in Laravel :

How to Define Multiple Log Channels in Laravel

You can define multi-channel in laravel logs as below:

The level parameter hold the severity of the message , if the message is debug then it will be logged by syslog channel. if the log message type is critical, then it will logged by slack channel.

we log a message using the debug method:
Log::debug('Debug message: Hi, I am phpflow.');

syslog channel will write the above message to the system log.

we log a message using the critical method:
Log::critical('critical message: Hi, I am phpflow.);

Any other type log message will be write into the both type channels. There are following other types log message available into the Laravel:

How To Log Contextual Information

An array of data may also be passed to the log methods. This array of data will be formatted and displayed with the log message:

Log::info('The service response is', ['resp' => $resp]);

Laravel Log message to Specific Channel

Sometimes you may wish to log a message to a specific channel other than your application’s default channel. You need to use channel() method to log message:

use Illuminate\Support\Facades\Log;
Log::channel('slack')->info('Something happened!');


We have learn log management system in laravel 8, defined the channel configuration and use with different types of log message. We can send the logs message into the specific channel.

Originally published at on May 4, 2021.




Hey, I am Parvez Alam. A software developer since 2009. I am a programming addict. I love learning and sharing knowledge.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Serverless on Google Cloud Platform

How to find logs of anypoint studio ?

Send Emails in Python django

Note to self: Please stop with the prototyping! Welcome “Dual”

The decentralization framework UniDAG

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Parvez Alam

Parvez Alam

Hey, I am Parvez Alam. A software developer since 2009. I am a programming addict. I love learning and sharing knowledge.

More from Medium

How to Create a Sign-Up and Login System Using HTML, PHP, and MySQL

How to Implement Select2 with Alpinejs & Laravel Livewire 2

How Laravel Should be The Preferred Choice for Web Development in 2022?

Wordpress Theme folder and file structure