Robert
Robert

Reputation: 2691

Ubuntu PHP Laravel write log into file

I have Ubuntu 18.04 and Laravel. In post method - upload file, I want to save parameters from upload files. At the begin I try to save something in the file:

public function settingsEdit($parameter)
{
        file_put_contents('/tmp/aa.log', 'll');

        return view('pages.account.settings.edit', ['user' => $this->user(), 'parameter' => $parameter]);
}

There is no error, but file isn't created. In tmp directory doesn't exists file aa.log.

Upvotes: 1

Views: 263

Answers (1)

Takachi
Takachi

Reputation: 751

You're using laravel, so you can do Storage::put('/tmp/aa.log', '11'); and you're file will be created in the storage folder, which is the default file location in Laravel.

Or maybe try to use https://github.com/rap2hpoutre/laravel-log-viewer package which create one log file every day.

Upvotes: 1

Related Questions