Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 Class Log Could not be Found

I am elbows deep in Laravel 5 and it's proving to be quite the bugger with the lack of autoloading. I am running into the weirdest of errors. I can't Log anything on my localhost. If it's a PHP error, it logs just fine, but if I try to write to the log, it throws an error. It's a Windows so no File Permission errors. Here's the error I get:

[2015-02-11 20:09:40] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\Http\Controllers\Log' not found' in C:\xampp\htdocs\bg_checks\laravel\app\Http\Controllers\BgInfoController.php:44
Stack trace:
#0 C:\xampp\htdocs\bg_checks\laravel\storage\framework\compiled.php(1721): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError(Array)
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()

Laravel 5 is still pretty new so there's not a lot of info on it. I've tried to find something and can only find a forum on Laracast's forum and nothing they suggested worked.

Help!

like image 770
cbloss793 Avatar asked Feb 11 '15 20:02

cbloss793


People also ask

Where to find Laravel error logs?

By default, Laravel is configured to create a single log file for your application, and this file is stored in app/storage/logs/laravel. log .

How to set log in Laravel?

'/logs/name-of-log. log'); Log::info([info to log]); The first parameter for both methods is the path of the log file (which is created if it doesn't already exist) and for useDailyFiles the second argument is the number of days Laravel will log for before erasing old logs.

How to enable error reporting in Laravel?

Through your config/app. php , set 'debug' => env('APP_DEBUG', false), to true . Or in a better way, check out your . env file and make sure to set the debug element to true.


1 Answers

I don't think you have a Log class file in App\Http\Controllers directory. So you must add

use Log;

if you are using Laravel's logger, or

use Path\To\Your\Log;

for a custom logger.

like image 113
Marty Aghajanyan Avatar answered Oct 11 '22 07:10

Marty Aghajanyan