Ovidiu Deac wrote:
Then I tried this:
    file = logging.FileHandler(logFileBasename, 'w')
    file.setLevel(logging.INFO)
    # set a format which is simpler for console use
    formatter = logging.Formatter('%(asctime)s %(name)-12s
%(levelname)-8s %(message)s',)
    # tell the handler to use this format
    file.setFormatter(formatter)
    # add the handler to the root logger
    logging.getLogger('').addHandler(file)
    logging.getLogger('')

...which also leaves my output file EMPTY.

I'm out of ideas. Can anybody help me with this?

Thanks in advance!
ovidiu
You set le level of your handler, but did not set the level of the logger itself. Replace file.setLevel(logging.INFO) by logging.getLogger().setLevel(logging.INFO)

Log events are matched versus the logger level 1st, then the handler level (if applicable). Most of the time you don't need to tune your handler levels.

JM

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to