I am trying to debug a Laravel web api. I am having trouble printing the request to log:
use Illuminate\ Support\ Facades\ Log;
//...
function text(Request $request) {
Log::info(print_r($request, true));
//...
}
The preceding code prints over 10 MB to the log. The same line without the "true" parameter prints only the date and time and nothing else. var_dump prints the same. dd does not print anything.
Do this instead:
use Illuminate\ Support\ Facades\ Log;
//...
function text(Request $request) {
Log::info($request);
//...
}
$request is a object, when u wanna debug, u just wanna show some info of it.
Such as:
your request data: $request->input()
your upload file: $request->allFiles();
And u also can use Log::error() try make debug info clearer.