For making Python loggers output all messages to stdout in addition to the log file you can use the following method which is using logging and sys module to :
One thing to note that all the logging output is handled by the handlers, you just need to add logging.StreamHandler() to the logger which is root.
Below is an example that is using stdout instead of the default stderr and also adding it to the root logger.
root = logging.getLogger()
handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
For more information, kindly refer to our Python course.