Skip to content
Tom Rothe edited this page Feb 15, 2013 · 3 revisions

Logging

Errors do happen. Either they

  • crash the server (shown in the console the server runs),
  • show up in the log file or
  • are given through to the client.

The log file can be found where the config setting of amsoil.config.LOG_FILE points to (typically log/amsoil.log). This setting can not be changed with the config client because logging needs to be available before the plugin system is loaded.

Use in development

Logging is a great way to show the administrator what is going on. Also when you debug your developments it is a good way to give yourself a clue where things go wrong. Hence, it is very useful to have AMsoil's log open and visible for developing: tail -f log/amsoil.log.

So please use the logging-service of AMsoil.
Here an example (note that the logger can be aquired on the top level of a package/file):

    import amsoil.core.log
    logger=amsoil.core.log.getLogger('pluginname')
    # logger is a decorated instance of Python's logging.Logger, so we only get one instance per name.
    
    def somemethod():
        logger.info("doing really cool stuff...")
        logger.warn("Oh Oh...")
        logger.error("Ba-Boooom!!!")

More information can be found in amsoil.core.log and Python's logging documentation.

Clone this wiki locally