How to view debug information or error information when using Laravel (7) filesystem calls?

Viewed 168

I am using the Laravel filesystem calls - for example: Storage::disk('sftp')->put and it is working fine but I am wondering how I can view debug or error information if there ever were the need?

So for example if the file upload failed, how would I see that? When I first wrote the code it was not working and there was no Laravel exception screen and nothing in the laravel.log.

1 Answers

I'm in the same case.

I'm using Laravel Storage library with league/flysystem-sftp for sftp transfer. Here is the problematic line.

Storage::disk(self::REMOTE_DISK)->putFileAs($destFolder, $this->localFilePath, $destFilename);

Most of the time all is working fine. File is copied from local to remote without any problem.

But sometimes one problem occurs and I failed to understand what's occured during the transfer. All I can do (at this time) is

$result = Storage::disk(self::REMOTE_DISK)->putFileAs($destFolder, $this->localFilePath, $destFilename);
if ($result === false) {
    $exception = new FileUploadFailureException("file upload has failed");
}

Is there a better way to debug one sftp connection trouble ?

Related