wish helps you Not exactly sure why this is the case but adding the StreamHandler first causes it to also write to the file. I moved the StreamHandler to after adding the TimedRotatingFileHandler and this resolved the problem.
Hope that helps Anything equal or worse than WARNING goes to wherever the main program (outside of my control) has configured the logging to go (usually stderr) Everything else (debug messages mainly) go to a log file You can't do it with a single logger without setting WARNING level on ancestor's handlers. From the docs:
import your_module # in the main application
your_module.get_logger().log_to_file(filename) # without this line your module
# shouldn't create debug files
Logging java jar stdout & stderr to a file in linux
I wish this help you Easiest way for me was the answer from jww. Use tee in the python script in conjunction with os.system and tee -a if you need to append the output of another script to the same logfile. test_script.py
cmd1 = "path/to/aribitrary_script | tee /path/to/logfile"
cmd2 = "path/to/another_script | tee -a /path/to/logfile"
if __name__ == '__main__':
Logging stdout and stderr to log file using Python 'with' statement