2014-05-15 110 views
0

我正在構建一個laravel應用程序,並且一切似乎都正常工作,除了我一直不斷收到這些錯誤出現在日誌文件中的事實。我的意思是他們每隔幾分鐘就會出現一次,有時更頻繁,有時更少 - 這使得在日誌文件中發現真正的問題變得更加困難。除了這些問題,它們並沒有真正引起任何問題 - 我有一個App :: missing方法來照顧真正的用戶。Laravel不斷記錄「未找到控制器方法」

您是否知道在何處尋找解決方案?

[2014-05-15 19:58:20] local.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' with message 'Controller method not found.' in /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:254 
Stack trace: 
#0 [internal function]: Illuminate\Routing\Controller->missingMethod(Array) 
#1 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array) 
#2 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('missingMethod', Array) 
#3 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(HomeController), Object(Illuminate\Routing\Route), 'missingMethod') 
#4 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/Router.php(934): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'HomeController', 'missingMethod') 
#5 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Array) 
#6 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/Route.php(105): call_user_func_array(Object(Closure), Array) 
#7 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1000): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) 
#8 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Routing/Router.php(968): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) 
#9 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(738): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) 
#10 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(708): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) 
#11 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Http/FrameGuard.php(38): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true) 
#12 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Http\FrameGuard->handle(Object(Illuminate\Http\Request), 1, true) 
#13 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true) 
#14 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true) 
#15 /Applications/MAMP/htdocs/gran.pw/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true) 
#16 /Applications/MAMP/htdocs/gran.pw/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(606): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request)) 
#17 /Applications/MAMP/htdocs/gran.pw/public/index.php(49): Illuminate\Foundation\Application->run() 
#18 {main} [] [] 

回答

0

它是一個404不存在的URL。

http://example.com/this-url-does-not-exist

要查看URL實際上是造成404 - 添加到您的過濾器文件

App::missing(function($exception) 
{ 
    Log::error('Missing URL was: ' . Request::fullUrl()); 
}); 

它會記錄任何異常在日誌中出現的URL。

這很可能是由於搜索引擎機器人嘗試搜索舊鏈接,或者可能是應用程序中的某些斷開的鏈接。

I did mention this to Taylor as a possible bug in Laravel 4.1 - http異常不會記錄缺少的url - 但它在當時是關閉的。我可能會重新打開它,因爲我確定它是一個錯誤(因爲舊的404記錄了這個url)。

+0

感謝您的想法!我會嘗試添加這一行,看看會發生什麼 – InGWeT

0

看起來像你的HomeController不延長Laravel的控制器:

class HomeController extends Controller { 

} 

因爲該方法missingMethod從你失蹤,這一次是在Laravel控制器基類。

+0

我所有的類都擴展了BaseController,它繼而擴展了Controller。你是這個意思嗎? – InGWeT

+1

如果你需要幫助的人,你必須分享你的代碼。我告訴我可以在日誌中看到什麼,Laravel試圖調用missingMethod並找不到它,因此您找到了一個找不到的方法。 –