selective logger disable/enable
garyjefferson123 at yahoo.com
Thu Jan 25 07:54:46 CET 2007
So maybe I don't have all this figured out quite as well as I thought.
What I really want to do is set an environment variable, MYDEBUG, which
contains a list of wildcarded logger names, such as "a.*.c a.d" (which
becomes ['a.*.c', 'a.d'], and then selectively crank the loglevel up to
DEBUG for those that match.
In order to do that, I think I need something kind of like filters, but
for logger name... I'm not seeing how to do this, even after playing
with variations of test15, 18, and 21.
What I do have working at the moment is passing a list of non-wildcard
logger names, i.e., doing the wildcard expansion manually such as
"['a.b.c', 'a.c.c', 'a.f.c', 'a.d']. Is there anyway to automate this
BTW, I do understand that 'a.d' is essentially equivalent to 'a.d.*',
but I'm dealing with a hierarchy that doesn't always tidy up like that.
For example, I have top.network.server.http, top.network.server.smtp,
top.network.client.http, and top.network.client.smtp. Obviously, if I
only want server or client DEBUG msgs, this is easy. And sometimes
that's exactly what I want. Other times, I want only smtp DEBUG msgs,
and the hierarchy won't help me get that (unless I break it for just
getting client or server msgs), etc. So I would really like to figure
out how to do 'a.*.c'.
On Jan 23, 3:01 am, "Vinay Sajip" <vinay_sa... at yahoo.co.uk> wrote:
> Glad the tests/examples (log_testxx.py) helped. When I get a
> chance, I will try to work some of them into the docs...
> Best regards,
> Vinay Sajip
More information about the Python-list