AttributeError: Logger instance has no attribute 'setFormatter'
Gabriel Genellina
gagsl-py at yahoo.com.ar
Mon Dec 11 21:04:56 EST 2006
At Monday 11/12/2006 22:32, johnny wrote:
>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'
If you look for setFormatter in the Python docs, you find that it is
an attribute of Handler instances. So, move it down to fhnd.setFormatter(...)
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list