I have two different points which I need to write to the same log file, one is a concole commando file and another is a web controller.
In both cases I use append command:
Storage::disk('local')->append($logfilePath, $content);
The problem is that file is created with permissions 664 (-rw-r--r--), so depend on the process that creates the file, the other one cannot write to it.
Is there any way to create file using Storage class with permission 666?
I share here the solution I found:
In
config/filesystems.phpI added the following code tolocal:When creating a new file I specify the permissions I want the file to have:
Notice that when using
append, you cannot set file permissions, even if it is not created yet.