Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Eixix's avatar
Level 1

Laravel 5.8 Log levels are not working

Hey there,

in my Laravel 5.8 application daily logs are working fine. However, when changing the log level inside the logging.php, it always keeps logging level debug. Other changes inside the logging.php get applied, but not the level.

My logging.php:

<?php
use Monolog\Handler\StreamHandler;
return [
    /*
    |--------------------------------------------------------------------------
    | Default Log Channel
    |--------------------------------------------------------------------------
    |
    | This option defines the default log channel that gets used when writing
    | messages to the logs. The name specified in this option should match
    | one of the channels defined in the "channels" configuration array.
    |
    */
    'default' => 'daily',
    /*
    |--------------------------------------------------------------------------
    | Log Channels
    |--------------------------------------------------------------------------
    |
    | Here you may configure the log channels for your application. Out of
    | the box, Laravel uses the Monolog PHP logging library. This gives
    | you a variety of powerful log handlers / formatters to utilize.
    |
    | Available Drivers: "single", "daily", "slack", "syslog",
    |                    "errorlog", "monolog",
    |                    "custom", "stack"
    |
    */
    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['single'],
        ],
        'single' => [
            'driver' => 'single',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
        ],
        'daily' => [
            'driver' => 'daily',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'error',
            'days' => 7,
        ],
        'slack' => [
            'driver' => 'slack',
            'url' => env('LOG_SLACK_WEBHOOK_URL'),
            'username' => 'Laravel Log',
            'emoji' => ':boom:',
            'level' => 'critical',
        ],
        'stderr' => [
            'driver' => 'monolog',
            'handler' => StreamHandler::class,
            'with' => [
                'stream' => 'php://stderr',
            ],
        ],
        'syslog' => [
            'driver' => 'syslog',
            'level' => 'debug',
        ],
        'errorlog' => [
            'driver' => 'errorlog',
            'level' => 'debug',
        ],
    ],
];
0 likes
10 replies
mohansharma's avatar

retry after clearing your cache Using these commands

php artisan config:cache php artisan config:clear

Eixix's avatar
Level 1

I cleared caches everytime, thats why the other changes worked. Only the log level change is the problem.

mohansharma's avatar

Add this in your app.php file 'log_level' => env('APP_LOG_LEVEL', 'error'), and clear the cache and it should work

Eixix's avatar
Level 1

Sadly no this does not work :/

Eixix's avatar
Level 1

Here is the .env

APP_ENV=production
APP_DEBUG=false
APP_KEY=randomstring
LOG_CHANNEL=daily

DB_HOST=localhost
DB_DATABASE=database
DB_USERNAME=user
DB_PASSWORD=password
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=redis

MAIL_DRIVER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_PRETEND=false

censored the important parts like passwords, urls or app keys

Snapey's avatar

open tinker

>>> config('logging')

What does it say?

1 like
Eixix's avatar
Level 1

It does say:

[
     "default" => "daily",
     "channels" => [
       "stack" => [
         "driver" => "stack",
         "channels" => [
           "single",
         ],
       ],
       "single" => [
         "driver" => "single",
         "path" => "/var/www/XXX/storage/logs/laravel.log",
         "level" => "debug",
       ],
       "daily" => [
         "driver" => "daily",
         "path" => "/var/www/XXX/storage/logs/laravel.log",
         "level" => "error",
         "days" => 7,
       ],
       "slack" => [
         "driver" => "slack",
         "url" => null,
         "username" => "Laravel Log",
         "emoji" => ":boom:",
         "level" => "critical",
       ],
       "stderr" => [
         "driver" => "monolog",
         "handler" => "Monolog\Handler\StreamHandler",
         "with" => [
           "stream" => "php://stderr",
         ],
       ],
       "syslog" => [
         "driver" => "syslog",
         "level" => "debug",
       ],
       "errorlog" => [
         "driver" => "errorlog",
         "level" => "debug",
       ],
     ],
   ]
Snapey's avatar

That looks ok, so rules out any discussion about .env and cache config.

So how are you determining what log level is being applied?

Eixix's avatar
Level 1

Hey Snapey, quite simple our log files have debug messages in them. Messages that get triggered by Log::debug('...')

Please or to participate in this conversation.