This gist demonstrates how to setup logging and write to both standard-error and a file.
Output is printed to stderr as well as a file. For example:
$ python logger.py
2020-02-19 11:46:59,473: WARNING: __main__: Starting to do stuff...
2020-02-19 11:47:01,480: INFO: __main__: Stuff done!
$ cat my-log.log
2020-02-19 11:45:34,918 - __main__ - WARNING - Starting to do stuff...
2020-02-19 11:45:36,920 - __main__ - INFO - Stuff done!