1

My laravel Log is filled with NotFoundHttpException in /forge/default/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:161, there are about ten of these exceptions logged per minute.

This makes it really hard to find anything useful in the Log file and the file itself grows large very quickly.

Is this from a bot trying to crawl the site or is possibly another issue? The log doesn't contain the URL being accessed so it is hard to tell if it is a 404 issue.

Thanks

Purple Haze
  • 530
  • 7
  • 22
  • the production site? try to access your nginx/apache logs also to see what they have – Vladyslav Startsev Aug 26 '17 at 14:54
  • Also try to something like that got to your `RouteServiceProvider` and in the mehtod called `map` put this ```Log::alert('url and method', [ 'url' => $this->app['request']->path(), 'method' => $this->app['request']->method(), 'referer' => $this->app['request']->headers->get('referer') ]); ``` This way you can get URL, method and referrer of each request – Vladyslav Startsev Aug 26 '17 at 15:05
  • Also go to your `App\Exceptions\Handler` override `report` method as it parent but instead of `$logger->error($e);` put `$logger->error($e,[ 'url' => $this->app['request']->path(), 'method' => $this->app['request']->method(), 'referer' => $this->app['request']->headers->get('referer') ]);` – Vladyslav Startsev Aug 26 '17 at 15:15
  • the second way is better because you will see on the logs only those request that had an error – Vladyslav Startsev Aug 26 '17 at 15:16
  • Thanks for the help. I check my access logs and there is an icon (that doesn't exist) that a page is trying to load. Can images / icons that don't exist cause the Exception to be logged? Thanks for the error logging tip I will add that to the handler. – user2573481 Aug 26 '17 at 15:28
  • yes, I was having issue like [this](https://stackoverflow.com/questions/12480497/why-am-i-getting-error-for-apple-touch-icon-precomposed-png). iPhone's was trying to access those but they doesn't exist so it produced an error. – Vladyslav Startsev Aug 26 '17 at 15:38

1 Answers1

0

The NotFoundHttpException means Laravel wasn't able to find a route to for the request.

You need to check the syntax of your routes, as stated in this documentation , your error occurs when a route you tried to access does not exist or you misspelled it either in your routes.php or in your browser's address bar.

Purple Haze
  • 530
  • 7
  • 22