Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Log::info in production using Laravel

I assumed that by default the Log::info calls wouldn't log in production, but they are still coming in.

Im setting production using my .env file

APP_ENV=production
APP_DEBUG=false

Ive tried these commands as well, but no luck

composer dump-autoload
php artisan cache:clear
php artisan optimize

Am i missing something?

like image 630
Parampal Pooni Avatar asked Oct 14 '25 11:10

Parampal Pooni


1 Answers

For anyone still finding this thread (8 years later):

Configure your log channels in config/logging.php file

Set "level" parameter for your log channel to a .env variable

Example:

  'channels' => [
    'slack' => [
      'driver' => 'slack',
      'url' => env('LOG_SLACK_WEBHOOK_URL'),
      'username' => 'Lumen Log',
      'emoji' => ':boom:',
      'level' => env('LOG_LEVEL', 'error'),
    ]
  ]

Now you can set the LOG_LEVEL variable in your .env file for each environment

like image 124
Anita Jensen Avatar answered Oct 17 '25 02:10

Anita Jensen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!