(continued from previous page) 

logger.info('creating an instance of auxiliary_module.Auxiliary ') a =auxiliary_module .Auxiliary() logger.info('created an instance of auxiliary_module.Auxiliary ') logger.info('calling auxiliary_module.Auxiliary.do_something ') a.do_something() logger.info('finished auxiliary_module.Auxiliary.do_something ') logger.info('calling auxiliary_module.some_function() ') auxiliary_module .some_function() logger.info('done with auxiliary_module.some_function() ') 

Here is the auxiliary module: 

import logging # create logger module_logger=logging.getLogger('spam_application.auxiliary ') classAuxiliary : def __init__ (self): self.logger=logging.getLogger('spam_application.auxiliary.Auxiliary ') self.logger.info('creating an instance of Auxiliary ') def do_something(self): self.logger.info('doing something') a =1+1 self.logger.info('done doing something') def some_function (): module_logger .info('received a call to"some_function "') 

The output looks like this: 

2005-03-23 23:47:11,663 - spam_application - INFO - creating an instance of auxiliary_module.Auxiliary 2005-03-23 23:47:11,665 - spam_application.auxiliary.Auxiliary - creating an instance of Auxiliary 2005-03-23 23:47:11,665 - spam_application - INFO - created an instance of auxiliary_module.Auxiliary 2005-03-23 23:47:11,668 - spam_application - INFO - calling auxiliary_module.Auxiliary.do_something 2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - doing something 2005-03-23 23:47:11,669 - spam_application.auxiliary.Auxiliary - done doing something 2005-03-23 23:47:11,670 - spam_application - INFO - finished auxiliary_module.Auxiliary.do_something 2005-03-23 23:47:11,671 - spam_application - INFO - calling auxiliary_module.some_function() 2005-03-23 23:47:11,672 - spam_application.auxiliary - INFO - received a call to 'some_function' 2005-03-23 23:47:11,673 - spam_application - INFO - done with auxiliary_module.some_function() 

