Neavehni
Neavehni

Reputation: 417

Default create log files with 664 permissions

How can I configure my Laravel or Ubuntu server so my Laravel logger creates a log file with the 664 permissions? Right now it defaults to 644. enter image description here

Upvotes: 3

Views: 1003

Answers (1)

Binar Web
Binar Web

Reputation: 943

Open config\logging.php file and add permission key to your default log channel. Is seems that this feature is available from Laravel 5.6.10.

Example:

return [
    'channels' => [
        'single' => [
            'driver' => 'single',
            'path' => storage_path('logs/laravel.log'),
            'level' => env('LOG_LEVEL', 'debug'),
            'permission' => 0664, // this is the new key to add
        ],
    ],
];

Notes:

  • in this example the default log channel is single
  • make sure the permission key has the value without quotes and with leading zero. read more about this in php manual of chmod

Upvotes: 3

Related Questions