6.2.6. Logging Service#

Logging records the history of events, whether normal or abnormal, surrounding GMT operations, such as whether an user has logged on to the GMT, or an observation has just been completed. Logging events are intended for view and access on a console, and stored in a persistent database.

The analysis package provides the capability to visualize or display specific information in the log database, e.g., automatically generate periodic reports reflecting operator activity, command logs, instrument and equipment activity. Messages generated during an observation can be added to the observation data bundle to enable provenance and quality monitoring. Sometimes major errors can arise first from scattered and seemingly harmless errors that are correlated in time. The supervisor service can define rules to detect and decide whether such occurrences are symptomatic of something more severe.

The following illustrates a log event specification:

# Logging Event Specification

EnumType "LogLevel",

    desc: "The log methods expect a log level, which can be used to filter
          log messages when they are retrieved. Levels follow OSGi Log Service
          Specification."

    literals:
        LOG_DEBUG:   "Used for problem determination and may be irrelevant to anyone but
                     the Component developer."
        LOG_ERROR:   "Indicates the component may not be functional. Action should be
                     taken to correct this situation."
        LOG_INFO:    "May be the result of any change in the component and does not
                     indicate problem."
        LOG_WARNING: "Indicates a component is still functioning but may experience
                     problems in the future because a warning condition"

    StructType "LogEvent",
        extends: []
        abstract: false
        desc: "Time stamped Log event"
        elements:
            value:
                type: "string"
                desc: "Text message with additional information related to the alarm event occurrence"
            timestamp:
                type: "TimeStamp"
                desc: "Time of the creation of the log message"
            level:
                type: "LogLevel"
                desc: "Level of the log event"
            source:
                type: "string"
                desc: "URI of the component that has issue the log message"

The figure below illustrates the Logging Service and the interactions between the components involved in the creation and propagation of log events. Adapters forward the log events to the log supervisor using push/pull sockets. Usually a single Log Adapter is deployed for all the components of a Subsystem that are collocated in the same computer. Although the interfaces are different this arrangement is similar to the design other services.

../../../_images/log-service-block-diagram.png

Fig. 6.9 Logging Service Block Diagram. (1) A Component creates a log message and invokes the log method inherited from the BaseComponent or BaseSupervisor classes. (2) The Service Adapters forward the log events to the log supervisor using push/pull sockets. Usually a single Log Adapter is deployed for all the components of a Subsystem that are collocated in the same computer. Although the interfaces are different this arrangement is similar to the design other services. (3) The Service Supervisor forwards the event to the subscribed components using a pub socket.#