We recommend logging out to separate files for your plugins so it’s easier to debug. You can use the built in logger within DivvyCloud, but the logs may be distributed over several log files which can make debugging cumbersome. To set up your own logging, simply add the following lines to the top of your plugin file.

class PluginLogging:
    This class initializes logging for the plugin. This will initialize and log to a
    single file underneath the logs directory. You can log to this file using
    PluginLogging.logger('your message here')

    def __init__(self):
        import logging
        self.logger = logging.getLogger(__name__)
        self.handler = logging.FileHandler('logs/%s.log' % __name__)
        self.formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

# Init logger for the plugin
pluginlog = PluginLogging()
global pluginlog

This block of code should go near the top of your plugin. You can then add log statements throughout your plugin by simplifying using the following line:

pluginlog.logger.info('This is my log line')

Note that your plugin is distributed across many processes so you likely will see duplicate log lines when looking at the logs. This is perfectly normal and is in no way indictative of an issue.