Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

hey python developer please try this method..

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

logger.setLevel(logging.DEBUG)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading