logging module: log file with datetime
Vinay Sajip
vinay_sajip at yahoo.co.uk
Fri Jun 1 09:46:51 EDT 2007
On 1 Jun, 13:00, Álvaro Nieto <alvaro.ni... at gmail.com> wrote:
> 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.
>
You can't do this just in the configuration - TimedRotatingFileHandler
automatically works out the filename in a predetermined manner when
doing rollover (dependent on whether it's doing rollovers daily,
hourly or whatever period). If you need more specific handling, you'll
need to write a subclass of TimedRotatingFileHandler which does what
you need.
Regards,
Vinay Sajip
More information about the Python-list
mailing list