How do laravel print out some string on console when running php artisan serve?
I tried Log::info
but it isn't working.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You've to config where laravel to store the logs. Default
Log::info()
put the log in the log file not the console. you can usetail -f logpath
to see the log.Try with
Read More
It's very simple.
You can call it from anywhere in APP.
Laravel 5.6 simplified this because you now have a
logging.php
config file you could leverage.The key thing to know is that you want to output to
stdout
and php has a stream wrapper built-in calledphp://stdout
. Given that, you could add channel for that wrapper. You would add the stdout "channel" to your channels that you will be logging to.Here's how the config will basically look:
I have more information here - Laravel 5.6 - Write to the Console