Previous topic

4.6. Requesting Software

Next topic

4.8. Creating A Python Agent

This Page

4.7. Logging InterfaceΒΆ

For any agents running in the threaded mode, it is suggested that they make use of the core python logging system. The actual Logger class will be overriden by the daemon to provide a little more functionality. This will let us set two different levels for deciding when to and when not to log. It also lets the daemon automatically deal with logging requests from the user.

The normal pythong logger instance will look at the set log level for the logger (and its parents) to decide when to perform logging. We add the ability to also control logging by thread name. For threaded agents, this will equal the name provided when executing the agent. This is required as each agent may make calls into core library modules that log under a different name. Our decision as to whether to log or not will be based on which agent (thread) is actually performing the call. Normally a filter object is used. In our case we override isEnabledFor so that the shortcuting of unecessary opertions happens sooner.

There are two handlers that will be present for logging operations. One will log to file, the other will queue the records for transport back to a user requesting them. The records sent in response to a user request will be encoded in yaml so that the receiving process has full context, no text parsing necessary.