AttributeError: Logger instance has no attribute 'setFormatter'

johnny rampeters at gmail.com
Mon Dec 11 20:32:08 EST 2006


I am getting a log error.  I am running ActiveState Python 2.4.3.  Any
help greatly appreciated.  Here is my code:

file.py
---------

def main()
     setupLogging()
     blah....

def setupLogging():
    global log
    log = logging.getLogger("ftp")
    formatter = logging.Formatter('%(name)-12s: %(levelname)-8s
%(message)s')

    log.setFormatter(formatter)
    log.setLevel(logging.DEBUG)

    fhnd = logging.FileHandler('py_mybase.log')
    fhnd.setLevel(logging.DEBUG)
    log.addHandler(fhnd)

My Error:
    log.setFormatter(formatter)
AttributeError: Logger instance has no attribute 'setFormatter'




More information about the Python-list mailing list