Re: selective logger disable/enable

2007-01-25 Thread Gary Jefferson
Gary Jefferson wrote: > 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 th

Re: selective logger disable/enable

2007-01-24 Thread Gary Jefferson
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 tho

Re: selective logger disable/enable

2007-01-23 Thread Vinay Sajip
Gary Jefferson wrote: > Vinay Sajip wrote: > > > > BTW I would also advise reading PEP-282 to understand more about the > > logging approach. > > > You've been most helpful, Vinay. The PEP section on Filters states > that I can do what I've been trying to do with filters, but doesn't > provide en

Re: selective logger disable/enable

2007-01-23 Thread Peter Otten
Gary Jefferson wrote: > Suppose I have 3 modules that belong to a project, 'A', 'A.a' and 'B', > and each module has its own logger, created with: > > module1logger = logging.getLogger('project.A') > > and > > module2logger = logging.getLogger('project.A.a') > > and > > module3logger = loggin

Re: selective logger disable/enable

2007-01-22 Thread Gary Jefferson
Vinay Sajip wrote: > > BTW I would also advise reading PEP-282 to understand more about the > logging approach. You've been most helpful, Vinay. The PEP section on Filters states that I can do what I've been trying to do with filters, but doesn't provide enough information to do it (or, at leas

Re: selective logger disable/enable

2007-01-21 Thread Vinay Sajip
Gary Jefferson wrote: > I am still a bit confused about Filters, though. It seems they are a > bit of an anomoly in the hierarchical view of loggers that the API > supports elsewhere, i.e., filters don't seem to inherit... Or am I > missing something again? Here's a quick example: > > import lo

Re: selective logger disable/enable

2007-01-21 Thread Gary Jefferson
Vinay Sajip wrote: > > I don't know enough about your target environment and application to > necessarily give you the best advice, but I'll make some general > comments which I hope are useful. You seem to be thinking that loggers > are binary - i.e. you turn them on or off. But they can be contr

Re: selective logger disable/enable

2007-01-21 Thread Vinay Sajip
Gary Jefferson wrote: > Thanks for the reply Vinay. I had been reading those docs prior to > posting, but addFilter/removeFilter only work on individual logger > instances and handlers. I want to globally enable/disable multiple > logger instances, based on their namespaces (see the example I >

Re: selective logger disable/enable

2007-01-20 Thread Gary Jefferson
Vinay Sajip wrote: > > The documentation for Logger - see > > http://docs.python.org/lib/node406.html > > - shows that there are addFilter() and removeFilter() methods on the > Logger class which you can use to add or remove filters from individual > Logger instances. From the above page (entitled

Re: selective logger disable/enable

2007-01-19 Thread Vinay Sajip
Gary Jefferson wrote: > Suppose I have 3 modules that belong to a project, 'A', 'A.a' and 'B', > and each module has its own logger, created with: > > module1logger = logging.getLogger('project.A') > > and > > module2logger = logging.getLogger('project.A.a') > > and > > module3logger = logging.get

selective logger disable/enable

2007-01-18 Thread Gary Jefferson
Suppose I have 3 modules that belong to a project, 'A', 'A.a' and 'B', and each module has its own logger, created with: module1logger = logging.getLogger('project.A') and module2logger = logging.getLogger('project.A.a') and module3logger = logging.getLogger('project.B') And I want to select