DEV Community

Al-Amin Islam
Al-Amin Islam

Posted on

Laravel logging

To help you learn more about what's happening within your application, 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.

In this folder there have the log file.

storage/logs
Enter fullscreen mode Exit fullscreen mode

We can create laravel custom log file. Go to the config\logging.php

//By default have 
  'single' => [
            'driver' => 'single',
            'path' => storage_path('logs/laravel.log'),
            'level' => env('LOG_LEVEL', 'debug'),
            'replace_placeholders' => true,
        ],

//here is the custom log example:

'custom' => [
            'driver' => 'single',
            'path' => storage_path('logs/custom.log'),
            'level' => env('LOG_LEVEL', 'debug'),
            'replace_placeholders' => true,
        ],
Enter fullscreen mode Exit fullscreen mode

If we want to show the every log data show our custom log file . Edit the .env file
replace

LOG_CHANNEL=stack to LOG_CHANNEL=custom
Enter fullscreen mode Exit fullscreen mode

Top comments (0)