Bird
0
0

Which of the following is the correct way to set up a file handler for logging in Flask?

easy📝 Syntax Q3 of 15
Flask - Deployment
Which of the following is the correct way to set up a file handler for logging in Flask?
Alogging.File('app.log')
Blogging.FileHandler('app.log')
Clogging.FileWrite('app.log')
Dlogging.FileOutput('app.log')
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct logging class for file output

    The correct class to write logs to a file is FileHandler.
  2. Step 2: Confirm the syntax for creating a file handler

    logging.FileHandler('app.log') creates a handler writing to 'app.log'.
  3. Final Answer:

    logging.FileHandler('app.log') -> Option B
  4. Quick Check:

    File logging setup = FileHandler class [OK]
Quick Trick: Use FileHandler to write logs to a file [OK]
Common Mistakes:
MISTAKES
  • Using non-existent classes like File or FileWrite
  • Confusing file handler with file output
  • Incorrect method names for logging

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes