Maksim Kasimov wrote: [Example snipped] Will the following do what you want?
Don't add handlers in each module. Just add a handler to the root logger in the main script. Thus: module1.py: import logging logger = logging.getLogger('module1') #now use the logger in your code module2.py: import logging logger = logging.getLogger('module2') #now use the logger in your code script.py: import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='/tmp/script.log', filemode='w') # this only works with 2.4+ - for earlier versions, need to do as in your original post Then, the output from loggers 'module1' and 'module2' will end up in '/tmp/script.log' automatically. Regards, Vinay -- http://mail.python.org/mailman/listinfo/python-list