Overriding Logging Config FileHandler Filename

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Sep 26 08:07:03 CEST 2007


On Sep 25, 9:15 pm, "Kenneth Love" <kl... at tax.ok.gov> wrote:
> I have a Pythonloggingconfig file that contains a RotatingFileHandler
> handler.  In the args key, I have hard-coded the log filename.  Everything
> works great.
>
> However, I find that I now need to override this filename at application
> runtime.  Is there a good way to do this?
>

Are you using the original file name mentioned in the config file at
all? Why and under what conditions do you need to switch? You could
easily do this programmatically - have two handlers and when you need
to, remove one from the logger and add the other. I see you are using
a rotating handler, which itself does rollover to new log files every
so often.

Regards,

Vinay Sajip




More information about the Python-list mailing list