Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
How to print out request to log

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.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Do this instead:

use Illuminate\ Support\ Facades\ Log;
//...
  function text(Request $request) {
    Log::info($request);
    //...
  }
over 4 years ago · Santiago Trujillo Report

0

$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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!