Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2, Laravel 9, RecursiveDirectoryIterator::__construct(/var/www/html/storage/logs//var/www/html/storage/logs/eApply): Failed to open directory: No such file or directory #302

Open
Delia-SimpleKYC opened this issue May 28, 2024 · 9 comments

Comments

@Delia-SimpleKYC
Copy link

Hi,
I am getting this error when using a subdirectory inside the logs directory, to save the logs:

This is my config/logging.php configuration:
'eApply' => [
'driver' => 'daily',
'path' => storage_path('logs/eApply/eApply.log'),
'level' => 'debug',
],

And then, when I open the log viewer, this error appears:
RecursiveDirectoryIterator::__construct(/var/www/html/storage/logs//var/www/html/storage/logs/eApply): Failed to open directory: No such file or directory

I'd appreciate your help on this. Thanks in advance

@Delia-SimpleKYC Delia-SimpleKYC changed the title RecursiveDirectoryIterator::__construct(/var/www/html/storage/logs//var/www/html/storage/logs/eApply): Failed to open directory: No such file or directory PHP 8.2, Laravel 9, RecursiveDirectoryIterator::__construct(/var/www/html/storage/logs//var/www/html/storage/logs/eApply): Failed to open directory: No such file or directory Jun 4, 2024
@Delia-SimpleKYC
Copy link
Author

@rap2hpoutre any ideas about the above? maybe I have to set something in the config file or something like that?

@elminson
Copy link
Contributor

elminson commented Jun 5, 2024

Hi @Delia-SimpleKYC,
Can you try to remove storage_path and logs from the path value?

'eApply' => [
'driver' => 'daily',
'path' => 'eApply/eApply.log',
'level' => 'debug',
],

is my believe path will attach the current log path to the route (/var/www/html/storage/logs//var/www/html/storage/logs/eApply)

as is showing in your error
RecursiveDirectoryIterator::__construct(/var/www/html/storage/logs//var/www/html/storage/logs/eApply): Failed to open directory: No such file or directory

@Delia-SimpleKYC
Copy link
Author

@elminson thanks for your help. I have made the change you suggested but then, the logs are saved in the "public" directory, not in the "storage" directory

@elminson
Copy link
Contributor

elminson commented Jun 5, 2024

@Delia-SimpleKYC not sure if you had run this command

php artisan vendor:publish \
  --provider="Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider"

but you need to copy this file to your config folder: https://github.com/rap2hpoutre/laravel-log-viewer/blob/master/src/config/logviewer.php
and set LOGVIEWER_STORAGE_PATH env var in your .env file to point to your full log path

https://github.com/rap2hpoutre/laravel-log-viewer/blob/49c52ae197b3d4f7f9e43d328628edc4bc529afa/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php#L44C1-L45C1

this line will look the storage_path in that order after those changes you should be able to do 'path' => 'eApply/eApply.log',

let me know if works ( I can try to replicate it in the next hours, this is just my guess)

@Delia-SimpleKYC
Copy link
Author

Delia-SimpleKYC commented Jun 5, 2024

@elminson but the default value of LOGVIEWER_STORAGE_PATH is the path to the logs (storage_path('logs')) ...

It still does not work with the change you suggested

@Delia-SimpleKYC
Copy link
Author

@elminson @rap2hpoutre it seems to be related with this Pull Request: #275

@elminson
Copy link
Contributor

elminson commented Jun 6, 2024

@Delia-SimpleKYC I will be testing the PR, and ask @rap2hpoutre if we can merge it (I may do some test cases to validate)

@Delia-SimpleKYC
Copy link
Author

@rap2hpoutre @elminson any update on this issue?

@elminson
Copy link
Contributor

@Delia-SimpleKYC I will be taking a deep look in to this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants