I am trying to set python logger which always writes INFO level to the stdout and at DEBUG level to a file. Something similar to
https://stackoverflow.com/a/11111212/3516550
but without creating anotherlogger object. I tried this, but both of them get the default level of logging.WARNING. Is there someway for me to set both to the original logging object? The rest of the code uses logging, I'd like to preserve that, if possible.
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.INFO)
file_handler = logging.FileHandler("my_log.log")
file_handler.setLevel(logging.DEBUG)
logging.basicConfig(handlers=[file_handler, stream_handler])
The python version I am using is
Python 3.6.3 :: Anaconda custom (64-bit)