Skip to main content
added 3 characters in body
Source Link
Vinay Sajip
  • 100.1k
  • 15
  • 184
  • 196

You need to set the logging level for the logger as well. By default, it's set to logging.WARNWARNING, so neither handler is seeing the message, let alone determining if it should be handled.

logging.basicConfig( level=logging.INFO, handlers={ _add_handler(logging.FileHandler("filename.log")), _add_handler(logging.StreamHandler()) }) 

You need to set the logging level for the logger as well. By default, it's set to logging.WARN, so neither handler is seeing the message, let alone determining if it should be handled.

logging.basicConfig( level=logging.INFO, handlers={ _add_handler(logging.FileHandler("filename.log")), _add_handler(logging.StreamHandler()) }) 

You need to set the logging level for the logger as well. By default, it's set to logging.WARNING, so neither handler is seeing the message, let alone determining if it should be handled.

logging.basicConfig( level=logging.INFO, handlers={ _add_handler(logging.FileHandler("filename.log")), _add_handler(logging.StreamHandler()) }) 
Source Link
chepner
  • 538k
  • 77
  • 594
  • 746

You need to set the logging level for the logger as well. By default, it's set to logging.WARN, so neither handler is seeing the message, let alone determining if it should be handled.

logging.basicConfig( level=logging.INFO, handlers={ _add_handler(logging.FileHandler("filename.log")), _add_handler(logging.StreamHandler()) })