Complete the code to import the logging module.
import [1]
The logging module is used to set up logging in Python.
Complete the code to set the logging level to DEBUG.
logging.basicConfig(level=[1])Setting level=logging.DEBUG enables detailed debug messages.
Fix the error in the code to log an info message.
logging.[1]("Test started")
The correct method to log an info message is info.
Fill both blanks to create a logger and set its level to WARNING.
logger = logging.getLogger([1]) logger.setLevel([2])
Create a named logger with getLogger and set its level to WARNING to filter messages.
Fill all three blanks to add a file handler that writes logs to 'app.log' with ERROR level.
file_handler = logging.FileHandler([1]) file_handler.setLevel([2]) logger.addHandler([3])
The file handler writes logs to 'app.log' and filters messages at ERROR level. It is then added to the logger.
