php 无法找到 Laravel 5 类日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28463823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel 5 Class Log Could not be Found
提问by cbloss793
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:
我在 Laravel 5 中手足无措,事实证明,由于缺乏自动加载功能,它非常麻烦。我遇到了最奇怪的错误。我无法在本地主机上记录任何内容。如果是 PHP 错误,它会记录得很好,但是如果我尝试写入日志,则会引发错误。这是一个 Windows,所以没有文件权限错误。这是我得到的错误:
[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.
Laravel 5 仍然很新,所以关于它的信息并不多。我试图找到一些东西,但只能在 Laracast 的论坛上找到一个论坛,而他们建议的任何内容都不起作用。
Help!
帮助!
回答by Marty Aghajanyan
I don't think you have a Log
class file in App\Http\Controllers
directory. So you must add
我认为您Log
在App\Http\Controllers
目录中没有类文件。所以你必须添加
use Log;
if you are using Laravel's logger, or
如果您使用的是 Laravel 的记录器,或者
use Path\To\Your\Log;
for a custom logger.
对于自定义记录器。