πŸ”₯ Welcome to my blog! Latest updates available now. Visit daily! πŸ”₯ πŸ”₯ Click Here for Latest Updates – Visit My Blog πŸ”₯
πŸ”₯ Latest Updates πŸ“Š GP Grade Finder πŸ“’ Government Services Info πŸ†• New Schemes Updates

all messages will be written to log file

 In the above program only WARNING and higher level messages will be written to log file.

If we set level as DEBUG then all messages will be written to log file.

Copy code

Python

1) import logging

2) logging.basicConfig(filename='log.txt', level=logging.DEBUG)

3) print("Logging Module Demo")

4) logging.debug("This is debug message")

5) logging.info("This is info message")

6) logging.warning("This is warning message")

7) logging.error("This is error message")

8) logging.critical("This is critical message")

log.txt:

Copy code


1) DEBUG:root:This is debug message

2) INFO:root:This is info message

No comments:

Post a Comment

Thank you Very Much.For Given Comment

Quatation of the Day 22-03-2026