lalo
1
I want to use the logger registered in config/app.php
'aliases' => [
...
'Log' => Illuminate\Support\Facades\Log::class,
...
however, it doesn’t work the same way than laravel.
What’s the correct way of using those facades?
This doesn’t work:
use Log;
Log::debug('An informational message.');
I believe you need to include the Log class in your PHP file like this:
use Illuminate\Support\Facades\Log;
And then check the application logs at your-sage-dir/storage/logs
. Output should go there.
lalo
3
Thanks, now I get:
Fatal error : Uncaught RuntimeException: A facade root has not been set.
If I use this code in bootstrap/app.php
use Illuminate\Support\Facades\Log;
Log::debug('test');
But this works:
use Illuminate\Support\Facades\Log;
add_filter('init', function () {
return Log::debug('test');
});
Any ideas why?
1 Like
My guess: probably that’s just not where that function is intended to be used.
system
Closed
5
This topic was automatically closed after 42 days. New replies are no longer allowed.