How to Log Laravel 404 Error With Details - laravel-4

Just as in the title, I am getting a 404 error in my Log but don't know where/why this error is happening cause my App is working fine without a problem.
Is there a way for me to log the error in details (the referral link) e.g
Error
[2014-11-30 05:44:13] production.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /home/domain/laravel/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php:146
Details
Detail: User tried to access route http://domain.com/users
Thanks, any help will be appreciated.

App::missing(function($exception)
{
Log::error( Request::url() );
return Response::view('errors.missing', array(), 404);
});
or use Request::fullUrl() this includes query strings in the URL
You need to make the view.

Related

Trying to redirect to previous view (with errors) after PostTooLargeException laravel 5.6

**(Laravel 5.6)**After submitting form with file input, laravel throws PostTooLargeException, I want to redirect back to upload view with error message. I found that I can redirect back in Handler.php method render() with:
`if ($exception instanceof \Illuminate\Http\Exceptions\PostTooLargeException)
{
return redirect()->back();
}
`
But I want to redirect with errors which will be shown in upload form view. I have tried all solutions at link below but nothing worked.
Laravel redirect back with() message
Thanks for help.
Here is image of exception:PostTooLargeException
Try increasing the 'post_max_size' in your php.ini file to avoid that exception
For the errors this should work
redirect()->back()->withErrors();
Here's a link that may help you trouble shoot why you are not seeing the errors. https://laracasts.com/discuss/channels/code-review/redirect-with-errors-not-working?page=1

Laravel redirect HttpException error

I'm trying to
Redirect::route('some_route');
I'm getting this error
throw new MethodNotAllowedHttpException($others);
Can anyone help me?
Redirect::route() sends GET request. You must have POST or some method set as the handler. Please change the route to handle GET request and you will be fine.

Laravel post route returning error 500

my route
Route::post('register', function()
{
return "POST SUCCESS!";
});
works fine if I chane it to "get".
As soon as I change it to post (and use postman to actually send a post request) I get an error 500.
Its driving me crazy and I cant find the answer..
There is also nothing in the php error log... o_0
Make sure you have created .env file for local environment.
Take a look at storage/logs/laravel.log, you should find error there, e.g.:
cat storage/logs/laravel.log | grep "\[201

Laravel 4: Redirecting when invalid route

I am trying to treat the invalid requests on my Laravel app, something like redirecting to the root will work just fine, but I can't manage to do it.
In the documentation and around stackoverflow I saw this is always the solution:
App::missing(function() {
# handle the error
});
I thought that would just go to the routes file but no. Then I saw in some post it should be in the app/start/global.php file but it still didn't work.
In the docs it says I can "register an error handle". Is that what I should do? What does this mean? What should I do?
Ultimately this can be put anywhere, but app/start/global.php is probably the best place for it.
App::missing(function($exception)
{
return Response::view('errors.missing', array(), 404);
});
Try putting this in there. In fact, if you've just setup a fresh installation, you should already have one there.
Here is how you can register an error handler, like so;
App::error(function(Exception $exception, $code)
{
//Now you can check for different exceptions and handle each on their own way.
}
This will be for PHP general Exception class which will make all exceptions go here, but you can change Exception to the specific Exception class of you own and handle it accordingly.
App::missing will generally be called when a page within your site has not been found, allowing you to show a default page for when users have found a non existing page. So if you are wanting to handle missing pages, use App::missing else use App::error.

MethodNotAllowedHttpException with lucadegasperi/oauth2-server-laravel's included AccessTokenFlow POST route

This is my first Laravel project I'm on, and it has been a ton of fun so far.
I'm setting up an OAuth2 server. I have copied the code posted here in to my routes file.
Via this block of code...
Route::post('oauth/access_token', function()
{
return AuthorizationServer::performAccessTokenFlow();
});
I have tried doing http://local.server.com/oauth/access_token and a "MethodNotAllowedHttpException" error.
If there is any other information I could provide that would help you help me, please tell me!
Cheers
If you are typing http://local.server.com/oauth/access_token into the browser URL bar, then you are sending the request:
GET oauth/access_token
However, your route handles a POST request, and since there is no GET route defined, Laravel is responding with MethodNotAllowedHttpException
In order to properly test your route, you will need to send a POST request.

Resources