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
        # 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")

2 answers

  • answered 2022-05-04 09:44 Daweo

    In logging.basicConfig you have requested


    thus only ERROR and more severe will be saved (see logging docs for hierarchy of levels), if you wish to have all set level to logging.DEBUG (least severe of all you have used) or logging.NOTSET

  • answered 2022-05-04 09:52 NEETU KUSHWAH

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


How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum