A Laravel project is working locally well but fails when deployed to an EC2 instance using ElasticBeanstalk. The error is:
PHP Fatal error: Uncaught Error: Class 'Log' not found in /var/app/current/app/Exceptions/Handler.php:35\nStack trace:\
The content of that line is \Log::error($e);
I've tried the following.
use Illuminate\Support\Facades\Log;
class Handler extends ExceptionHandler
{
...
public function report(Exception $e)
{
...
{
Log::error($e);
}
}
With this, I get a new error of:
PHP Fatal error: Uncaught RuntimeException: A facade root has not been set.
I also tried use Log
but got an error PHP Fatal error: Uncaught Error: Class 'Log' not found
.
Both these fails:
use Illuminate\Support\Facades\Log;
class Handler extends ExceptionHandler
{
...
public function report(Exception $e)
{
...
{
Log::error($e);
}
}
class Handler extends ExceptionHandler
{
...
public function report(Exception $e)
{
...
{
\Log::error($e);
}
}
I didn't expect this error. My expectation was that Laravel already has this class.
Ps: I'm new to Laravel.