i want to print all the messages in logfile

I have created a log file and only error and critical messages are appearing as output I have to display all the messages

import logging
        Log_format="%(levelname)s %(asctime)s - %(message)s"
    **create and configure logger**
        logging.basicConfig(filename="logfile.log",
                            filemode='w',
                            format=Log_format,
                            level=logging.ERROR)
        logger=logging.getLogger()
    **test messages**
        logger.error("first logging message")
        logger.debug("Harmless debug Message")
        logger.info("Just an information")
        logger.warning("Its a Warning")
        logger.error("Did you try to divide by zero")
        logger.critical("Internet is down")

>Solution :

hey python developer please try this method..

you have to set the threshold of logger to DEBUG..

logger.setLevel(logging.DEBUG)

Leave a Reply