Recall & Review
beginner
What is the main purpose of logging in production?
Logging in production helps track what the application is doing, find errors, and understand user behavior without stopping the app.
Click to reveal answer
beginner
Which Python module is commonly used for logging in Flask applications?
The built-in
logging module is commonly used for logging in Flask applications.Click to reveal answer
beginner
What is a log level and why is it important?
A log level shows how serious a message is (e.g., DEBUG, INFO, WARNING, ERROR). It helps filter messages so you see only what matters in production.
Click to reveal answer
intermediate
How can you configure Flask to write logs to a file in production?
You can set up a
FileHandler in the logging module to write logs to a file, and attach it to Flask's logger.Click to reveal answer
beginner
Why should you avoid logging sensitive information in production?
Logging sensitive data can expose private user info or secrets if logs are accessed by unauthorized people. It risks security and privacy.
Click to reveal answer
Which log level should you use to record unexpected errors in production?
✗ Incorrect
ERROR level is used to log serious problems that need attention in production.
What does the
logging.FileHandler do in Flask logging?✗ Incorrect
FileHandler writes log messages to a file.Why is the DEBUG log level usually turned off in production?
✗ Incorrect
DEBUG logs are very detailed and can clutter logs and affect performance in production.
Which of these is NOT a good practice for production logging?
✗ Incorrect
Logging sensitive data like passwords is a security risk and should be avoided.
How can you make sure logs don’t fill up disk space in production?
✗ Incorrect
Log rotation helps manage disk space by archiving or removing old logs.
Explain how to set up logging in a Flask app for production use.
Think about how to send logs to a file and control what messages appear.
You got /4 concepts.
Describe why managing log levels is important in production environments.
Consider what happens if you log too much or too little.
You got /4 concepts.