0

I have Laravel 5.1. It logs CGI (web stuff) with the apache account and that's fine. The problem is if I need to get on there to run an artisan command that I created (that also uses the Log class) it fails because it doesn't have permission to write to the log file that apache created. Is there a way to tell laravel to log to different places based on whether it's via web or cli?

alariva
  • 2,051
  • 1
  • 22
  • 37
Joel Joel Binks
  • 1,628
  • 5
  • 27
  • 47

1 Answers1

2

Heading to your config/app.php file you can choose the Log driver according to the executing user.

config/app.php

/*...*/
    'log' => php_sapi_name() === 'cli' ? 'syslog' : 'daily',
/*...*/

You can also change the log detail level if you want to mute it completely.

Community
  • 1
  • 1
alariva
  • 2,051
  • 1
  • 22
  • 37