Re: RotatingFileHandler and logging config file
From: Peter Hansen (peter_at_engcorp.com)
Date: 03/19/05
- Next message: Lorn Davies: "Re: Working with Huge Text Files"
- Previous message: Peter Hansen: "Re: Checking if port is in use."
- In reply to: Rob Cranfill: "Re: RotatingFileHandler and logging config file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 19 Mar 2005 12:22:38 -0500
Rob Cranfill wrote:
> Ah, now *there's* an intriguing approach! I am too much a Python noob to
> know - can I subclass RFH and then invoke that new class from a config
> file (the crux of my original question) ? I may play around with it
> today....
There's at least one way that will work, though it may not be
the cleanest approach.
Wherever you create your subclass, stick a reference to it in
the logging.handlers module, as "logging.handlers.MyClass = MyClass".
Then the config file can load it just as you now load the
existing class (which I assume looks like the usual examples,
with "class=handlers.RotatingFileHandler").
The logging.cfg file is executed in the context of the logging
module's namespace, so you could also stick your names directly
in there and skip the "handlers." part, but that might be
even less clear...
-Peter
- Next message: Lorn Davies: "Re: Working with Huge Text Files"
- Previous message: Peter Hansen: "Re: Checking if port is in use."
- In reply to: Rob Cranfill: "Re: RotatingFileHandler and logging config file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|