that it puts all logging messages in /tmp/test.log instead so that in
my unittest I can inspect that it logs things correctly. Hopefully
this "pseudo" code will explain my problem::
True>>import logging, os
logging.basicConfig(filename='/tmp/real.log', level=logging.INFO)
logger = logging.getLogger('Real')
logger.info('Real stuff')
os.path.isfile('/tmp/real.log')
False>># do the monkey patching like the unit test does
logging.basicConfig(filename='/tmp/test.log', level=logging.INFO)
logger = logging.getLogger('Test')
logger.info('Test stuff')
os.path.isfile('/tmp/test.log')
'INFO:Real:Real stuff\nINFO:Test:Test stuff\n'>>open('/tmp/real.log').read()
How can I change what file the logger should write to?