Home > Software design >  Laravel console not logging out any data
Laravel console not logging out any data

Time:08-03

I have a laravel application where I'm trying to log out some different data output to the console.

I have used error_log("...")


Log::info("the message for log");

But whatever technique I use, the only output is regular logs to the endpoints being hit by the requests.

strong text

When I run my application, I simply type in php artisan serve

Do I need to add some special flags for debugging, or what is causing this issue?

CodePudding user response:

I have not tried this...But hope this works..

$logInfo = new Symfony\Component\Console\Output\ConsoleOutput();
$logInfo->writeln("<info>Error message</info>");

Log::info("the message for log");

This logs to Laravel's log file located at app/storage/logs/laravel.log

CodePudding user response:

You can only output to the console from artisan commands.

Perhaps you are looking for something like the free laravel-dump-server

https://beyondco.de/docs/laravel-dump-server/installation

When installed, this will echo log information to the dump server running in the console.

  • Related