logging module: log file with datetime

Álvaro Nieto alvaro.nieto at gmail.com
Fri Jun 1 08:00:33 EDT 2007


Hi

    I have this logging config file;

====================================================================

[loggers]
keys=cdmto

[handlers]
keys=cdmtoHandler

[formatters]
keys=mtoFormatter

[logger_cdmto]
level=DEBUG
handlers=cdmtoHandler
qualname=cdmto
propagate=0

[handler_cdmtoHandler]
class=handlers.TimedRotatingFileHandler
level=DEBUG
formatter=mtoFormatter
args=('./Logs/cdmto.log',)

[formatter_mtoFormatter]
format=%(asctime)s %(levelname)-8s %(filename)s[%(lineno)d]: %
(message)s
datefmt=

====================================================================

    How could I define a log file with datetime in his name?. Now the
name
    for log file is './Logs/cdmto.log' and I'd like it would be './
Logs/cdmto_20070601.log',
    for example.

Thanks.




More information about the Python-list mailing list