Python Programming - Standard Libraries - Discussion
Discussion Forum : Standard Libraries - General Questions (Q.No. 82)
82.
How can you use the
logging
module in Python to configure a logger with a specific log level and output format?
Answer: Option
Explanation:
import logging
# Example usage of logging module for configuring a logger
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(message)s')
logger = logging.getLogger('my_logger')
logger.debug('This is a debug message')
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers