Bird
0
0

Given this logging config snippet, what will be the output when logging an error?

medium📝 Predict Output Q4 of 15
Laravel - Configuration and Environment
Given this logging config snippet, what will be the output when logging an error?
'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'slack']], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug'], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'level' => 'error']]
AError not logged anywhere due to missing config
BError logged to both laravel.log file and Slack channel
CError logged only to Slack channel
DError logged only to laravel.log file
Step-by-Step Solution
Solution:
  1. Step 1: Analyze 'stack' channel behavior

    The 'stack' driver sends logs to all channels listed in 'channels' array.
  2. Step 2: Check levels and channels

    'single' logs all levels from debug up, 'slack' logs only errors and above.
  3. Final Answer:

    Error logs go to both laravel.log and Slack -> Option B
  4. Quick Check:

    Stack channel sends to all listed channels [OK]
Quick Trick: Stack sends logs to all its channels [OK]
Common Mistakes:
  • Thinking Slack logs only warnings
  • Assuming stack logs to one channel only
  • Ignoring log level filters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes