I have a piece of code that is initializing a logger as below.
logger = logging.getLogger() hdlr = logging.FileHandler('logfile.log') formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.setLevel(logging.DEBUG) Unfortunately this code is being called multiple times, is there any way I can check to see if the handler already exists - I'd prefer to implement this without having to use a Singleton.
EDIT: Sorry, forgot to mention this is on python 2.5 - cheers, Richard