Answers for "laravel where to find logs"

PHP
6

laravel logs

use Illuminate\Support\Facades\Log;

// Severity levels base on RFC5424 commented on the right side
Log::emergency($message);	// system is unusable
Log::alert($message);		// action must be taken immediately
Log::critical($message);	// critical conditions
Log::error($message);		// error conditions
Log::warning($message);		// warning conditions
Log::notice($message);		// normal but significant condition
Log::info($message);		// informational messages
Log::debug($message);		// debug-level messages

// Checkout RFC5424 here - https://tools.ietf.org/html/rfc5424
Posted by: Guest on February-26-2021
0

how get query logs in laravel

Method #1
instead of ->get use ->toSql() on query 
$users = User::orderBy('name', 'asc')->toSql();

echo $users;

// Outputs the string:
'select * from `users` order by `name` asc'
Method # 2

DB::enableQueryLog();

// and then you can get query log

dd(DB::getQueryLog());
Posted by: Guest on November-30-2021
0

ubuntu where are laravel logs stored

Ensure debug mode is on - either add APP_DEBUG=true to .env file or set an environment variable

Log files are in storage/logs folder. laravel.log is the default filename. If there is a permission issue with the log folder, Laravel just halts. So if your endpoint generally works - permissions are not an issue.

In case your calls don't even reach Laravel or aren't caused by code issues - check web server's log files (check your Apache/nginx config files to see the paths).

If you use PHP-FPM, check its log files as well (you can see the path to log file in PHP-FPM pool config).
Posted by: Guest on October-15-2021

Browse Popular Code Answers by Language