Thanks, tried the next:
logging.basicConfig(filename='filename.log', level=logging.DEBUG)
logger = logging.getLogger()
def warn(s):
logging.warn(s)
ic.configureOutput(outputFunction=warn)
But it didn't create the .log file and the ic output was printed on the screen instead of the file (that was never created anyway)