Čamo's avatar
Level 3

Production Laravel 11 does not log Target class xz does not exist error

I forgot to commit one middleware class file to the server and it did not log any errror. When I try to use non existing class on my local machine it throws clear errro 500 Target class Test2 does not exist. Can somebody tell me if I forgot to set something on production server as a reason why I can not find anything in laravel.log file? Server returns error 500 but I dont see any error in log file.

0 likes
3 replies
Talinon's avatar

@Čamo My guess would be you need to adjust the file permissions on your storage/logs directory. If it doesn't have access to write to the file, it has nothing else to do but throw a 500 and abort.

Čamo's avatar
Level 3

@Talinon Good idea but the permissions allows to write to log file.

Talinon's avatar

@Čamo I'd double check that. Check the directory permission itself, as depending on your logging configuration, it might be trying to create a new file in a directory it can't write to.

If you're absolutely certain those permissions are fine, then the next thing to check would be your actual webserver log file. If you're using Apache, then it should be somewhere like /var/log/apache2.

You can also try running php artisan in your project's root directory. If there is something critically wrong during the application bootstrapping, it will immediately export an error to the terminal.

Please or to participate in this conversation.