Complete the code to set the logging level to capture all messages.
logging.basicConfig(level=[1])Setting the level to logging.DEBUG captures all messages including debug, info, warning, error, and critical.
Complete the code to create a logger named 'appLogger'.
logger = logging.getLogger([1])Using "appLogger" names the logger as required.
Fix the error in the code to add a file handler to the logger.
file_handler = logging.FileHandler([1])
logger.addHandler(file_handler)The filename must be a string, so it needs quotes like "app_log.txt".
Fill both blanks to format log messages with time and level.
formatter = logging.Formatter("[1] - [2] - %(message)s") file_handler.setFormatter(formatter)
The format includes the timestamp (%(asctime)s) and the log level (%(levelname)s).
Fill all three blanks to create a dictionary that filters logs with level ERROR or higher.
error_logs = {k: v for k, v in logs.items() if v['level'] [1] [2] and v['level'] [3] 'CRITICAL'}The filter keeps logs where level is between ERROR and CRITICAL inclusive, so use >= 'ERROR' and <= 'CRITICAL'.