Re: python logging module problem

2006-07-14 Thread Ritesh Raj Sarraf
Peter Otten wrote: > You can achieve the desired behaviour by adding a custom Filter: > > import sys > import logging > > logger = logging.getLogger("my_app") > logger.setLevel(logging.DEBUG) > > class LevelFilter(logging.Filter): > def __init__(self, level): > self.level = level >

Re: python logging module problem

2006-07-14 Thread Peter Otten
Ritesh Raj Sarraf wrote: > Vinay Sajip wrote: >> It's usual to rely on logger levels and to set handler levels for >> additional refinement of what goes to a particular handler's >> destination. > The problem is that for StreamHandler, logging module logs to > sys.stderr. > I want to use the lo

Re: python logging module problem

2006-07-14 Thread Ritesh Raj Sarraf
Vinay Sajip wrote: > > It's usual to rely on logger levels and to set handler levels for > additional refinement of what goes to a particular handler's > destination. > The problem is that for StreamHandler, logging module logs to sys.stderr. I want to use the logging feature for most of the mess

Re: python logging module problem

2006-07-14 Thread Vinay Sajip
Ritesh Raj Sarraf wrote: > When I execute the above code, logger.info()'s messages don't get > displayed. And logger.warning()'s messages get displayed twice. > The warning messages are displayed twice because you have two handlers which both output to the console. The reason you don't get the i

Re: python logging module problem

2006-07-13 Thread Ritesh Raj Sarraf
Ritesh Raj Sarraf wrote: > import os, sys, logging > > logger = logging.getLogger("my_app") > I tried this code: import logging, sys # set up logging to file - see previous section for more details logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(le