Bird
0
0

What will be the output of this Django logging configuration snippet?

medium📝 Predict Output Q5 of 15
Django - Deployment and Production
What will be the output of this Django logging configuration snippet?
LOGGING = {
    'version': 1,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': 'ERROR',
        },
    },
}

If a warning is logged using Django's logger?
AThe warning will not appear in the console output
BThe warning will appear in the console output
CAn error will occur due to misconfiguration
DThe warning will be saved to a file instead
Step-by-Step Solution
Solution:
  1. Step 1: Understand logging levels

    The logger is set to level 'ERROR', so it only logs messages with level ERROR or higher.
  2. Step 2: Check the logged message level

    A warning is lower than ERROR, so it will be ignored and not sent to the console handler.
  3. Final Answer:

    The warning will not appear in the console output -> Option A
  4. Quick Check:

    Logger level ERROR ignores warnings [OK]
Quick Trick: Logger level filters out lower severity messages [OK]
Common Mistakes:
MISTAKES
  • Assuming warnings always appear
  • Thinking configuration causes errors
  • Believing warnings go to files automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes