Laravel logging

developeralamin

Al-Amin Islam

Posted on July 5, 2024

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
💖 💪 🙅 🚩
developeralamin
Al-Amin Islam

Posted on July 5, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related