Logging MessagesΒΆ

Logging is built into GloMPO and users may optionally configure its logging capability before running the manager in order to track its progress. Without this manual configuration no progress or status message will print at all! The logging system can be used to debug the code, but is most helpful in tracking execution through the program by sending logging.INFO level messages and above to sys.stdout.

The logging provided in this way is distinct from the summary files provided at the end of the GloMPO run which are regulated by GloMPOManager.summary_files.

The GloMPO logger is called 'glompo' and components have individual loggers too, allowing filtering if desired. These are: 'glompo.manager', 'glompo.exitcondition', 'glompo.logger', 'glompo.generator', 'glompo.stopper', 'glompo.selector' and 'glompo.optimizers'. Logging from optimizers can be accessed collectively via 'glompo.optimizers' or individually for each optimizer via 'glompo.optimizers.optX' where 'X' is the ID number of the optimizer (see SplitOptimizerLogs for the logging.Filter needed to achieve this).

Within user written plug-ins, such as custom stoppers and exit conditions, a logger attribute (instance of logging.Logger) is present and can be used to log behaviour. The interested user is directed to the Python documentation for the logging package for details on how to customise this functionality.

An example configuration may look like:

formatter = logging.Formatter("%(asctime)s : %(levelname)s : %(lineno)d : %(name)s :: %(message)s")

handler = logging.FileHandler('glompo.opt_log', 'w')
handler.setFormatter(formatter)

logger = logging.getLogger('glompo')
logger.addHandler(handler)
logger.setLevel('INFO')

manager = GloMPOManager(...)
manager.start_manager(...)