I haven't been able to find a solution to this problem elsewhere, even though it seems it should be a common one.
import logging
logging.basicConfig(filename='logs.log', level=logging.INFO)
logging.info('something happened')
I want to create and write to the log file, but instead it displays the messages in the notebook output cell.