Centralized diagnostic logging service6591228Abstract A logging service logs diagnostic messages from applications executing in a mainframe computing environment to a centralized log. A mainframe computing environment has a plurality of mainframes coupled to a coupling facility. The coupling facility has a data storage area called a "logstream." Each mainframe has one or more subsystems executing applications. Each application preferably contains an API block, which is populated by the application and passed to a logging service API when the application desires to store a diagnostic message in the logstream. The logging service API writes the diagnostic messages to the logstream. In one subsystem, the logging service API contacts an alert facility in response to certain diagnostic messages received from applications. The logging service API in this subsystem also uses a message queue to pass the diagnostic messages to a subsystem able to write to the logstream. Claims We claim: Description BACKGROUND OF THE INVENTION
LOGGING SERVICE API BLOCK STRUCTURE
Level Argument Name Format Description
1 LOG-API Structure Message Block, which includes the
following
fields:
2 LOG-SERVICE- Structure Details of the Logging Service
DATA
3 LOG-SERVICE- PIC The name of the Common Technical Service.
NAME X(16) This is preferably a constant: `LOGGING`.
3 LOG-MAJOR- PIC The Major Version Number of the logging
VERSION 9(02) service.
This is preferably a constant. Value
depends on
version.
3 LOG-MINOR- PIC The Minor Version Number of the logging
VERSION 9(02) service
This is preferably a constant. Value
depends on
version.
2 LOG-MODULE- PIC This is preferably a constant `COVLOG10`.
NAME X(08)
2 LOG-RTRN- PIC The Proc return Code.
CODE 9(04) PROC-SUCCESS VALUE 0
PROC-FATAL-ERROR VALUE 90
2 LOG-RETURN- PIC LOG-WARNING VALUES; `0010` THRU `0999`
DETAIL X(04) LOG-ERROR VALUES `1000` THRU `9999`
LOG-INVALID-VERSION VALUE `1000`
LOG-NO-EVENT-TYPE VALUE `1001`
LOG-BAD-ALERT-IND VALUE `1002`
LOG-BAD-DEBUG-IND VALUE `1003`
LOG-BAD-LONG-MSG-IND VALUE `1004`
LOG-BAD-LONG-MSG-LEN VALUE `1005`
LOG-GENLOG-FAILED VALUE `2000`
LOG-ALERT-FAILED VALUE `3000`
LINK-ALERT-FAILED VALUE `3001`
LOG-DEBUG-FAILED VALUE `4000`
LOG-CICS-ERROR VALUE `5000`
LOGLINK-FAILED VALUE `5001`
NOT-AUTHORIZED VALUE `5002`
LOG-LOGGING-DISABLED VALUE `9999`.
2 LOG-MESSAGE- Structure The `Fixed` data relating to the logged
event
HEADER
3 LOG-PROD- PIC Client's Product Delivery Channel, if
known.
DELIV-CH X(02)
3 LOG-BUS-SVCE PIC The Business Service related to the
calling
X(08) module.
3 LOG-ON- PIC The Business Service from which the
caller was
BEHALF-BUS- X(08) invoked
SVCE
3 LOG-PGM-NAME PIC The name of the calling module.
X(08)
3 LOG-USER-ID PIC The current UserID that invoked the
business
X(20) service
3 LOG-UOW- PIC The Unit of Work Token for end-to-end
tracing
TOKEN X(32)
3 LOG-TRACE- Structure Sub-structure within Message-Header
DATA Occurs 3 times
This structure contains user-defined
event trace
variables.
4 LOG-TRACE- PIC User-supplied Name/Key of the Trace
Variable
LABEL X(10)
4 LOG-TRACE- PIC User-supplied Trace data
VALUE X(20)
2 LOG-MESSAGE- Structure Describes the actual Event
DATA
3 LOG-EVENT- PIC An Event classification code. The user
has the
TYPE-CODE X(02) freedom to define new event
classifications.
SYSTEM-ERROR VALUE `S1`
SYSTEM-WARNING VALUE `S2`
SYSTEM-INFO VALUE `S3`
BUSINESS-REJECT VALUE `B1`
BUSINESS-WARNING VALUE `B2`
BUSINESS-INFO VALUE `B3`
AUDIT-REJECT VALUE `A1`
AUDIT-WARNING VALUE `A2`
AUDIT-INFO VALUE `A3`
INFO-PUB-API-INVOKED VALUE `I1`
INFO-PRIV-API-INVOKED VALUE `I2`
INFO-DB-API-INVOKED VALUE `I3`
INFO-MODULE-INVOKED VALUE `I4`
INFO-PUBLIC-API-TERM VALUE `I5`
INFO-PRIVATE-API-TERM VALUE `I6`
INFO-DB-API-TERM VALUE `I7`
INFO-MODULE-TERM VALUE `I8`
INFO-STATEMENT VALUE `I9`.
3 LOG-ALERT-IND PIC Determines if ALERT must be generated
(Y/N)
X(01)
3 LOG-ALERT- PIC Message ID used by Mainframe Alert
Service
MSG-ID X(08) This ID is associated with a specific
ALERT
action to be taken by the Alert facility
when this
ID is detected.
3 LOG-DEBUG-IND PIC Not used.
X(01)
3 LOG-SHORT- PIC Fixed length short message
MSG-TX X(60)
3 LOG-APPL-CD PIC Owning application of Message ID
X(02)
3 LOG-APPL-MSG- PIC Message ID of message
ID 9(05)
3 LOG-LONG-MSG- PIC Determines if a long message is being
passed as a
IND X(01) parameter. See LOG-MESSAGE-AREA and
LOG-MESSAGE-LEN-QY.
The following data is optional
3 LOG-MESSAGE- PIC Defines length of variable-length message
(1 to
LEN-QY 9(05) 32,000)
The API block 216 is associated with a logging service API 218 in the OLTP subsystem 210. An application 214 generates a diagnostic message by calling the logging service API 218 with the populated API block 216. In FIG. 2, the OLTP subsystem 210 has two logging service APIs, labeled 218A and 218B. Logging service API 218A is a legacy logging service called by legacy applications developed before the advent of the present invention. Logging service API 218B is configured to store diagnostic messages in the logstream 116 and is preferably called by applications developed after the advent of the present invention. In one embodiment of the present invention, the legacy logging service API 218A is altered to pass calls from legacy applications to the other logging service API 218B. This technique allows the present invention to support legacy applications without requiring the legacy applications to be modified. Of course, if no legacy applications are present there is no need for the legacy logging service API 218A. The logging service API 218B in the OLTP subsystem 210 is preferably connected to an alert facility 220. The alert facility 220 signals an alert to an automated system and/or a human operator of the computing environment in response to certain diagnostic messages generated by the applications. In one embodiment of the present invention, an application can activate the alert facility 220 by setting the LOG-ALERT-IND field in the API block 216 to "true." In addition, the application can specify an action to be performed by the automated system by setting the LOG-ALERT-MSG-ID field. In addition, the logging service API 218 is preferably coupled to a message queue 222. The message queue 222 is utilized because the version of the OS/390 operating system used by one embodiment of the present invention does not allow applications, including the logging service API 218B, in the OLTP subsystem 210 to write directly to the logstream 116. Therefore, the logging service API 218B uses the message queue 222 to pass the diagnostic messages to a subsystem that allows logstream 116 access. Preferably, an application 224 executing as a long-running batch task drains the message queue 222 and writes the diagnostic messages to the logstream. In FIG. 2, the batch subsystem 212 also has two applications 226A, 226B, each having an API block 228A, 228B, and two logging service APIs 230A, 230B. As with the example illustrated in the OLTP subsystem 210, application 228A is a legacy application and calls the legacy logging service API 230A. The older logging service API 230A, in turn, passes calls to logging service API 230B. Applications executing in the batch subsystem 212 can write directly to the logstream 116. Therefore, the logging service API 230B preferably does not use the message queue 222 and instead writes diagnostic messages directly to the logstream 116. In the illustrated embodiment, the logging service API 230B in the batch subsystem 212 does not interact with the alert facility 220 because the functionality of the alert facility can be obtained by writing messages to an MVS system console, although those of ordinary skill in the art will recognize that this capability can be included in alternative embodiments. FIG. 2 also illustrates two applications for reviewing the data in the logstream 116. A report and extract utility 232 extracts data from the logstream 116 based on user-defined criteria, including, for example, the date, time, business service name, user ID, program name, environment (OLTP or batch), transaction ID, job name, application code, product code, and/or the OLTP region name. An interactive browser 234 utility allows a user to browse real-time logstream data. A preferred embodiment of the browser 234 supports all standard browse features, such as hex on/off, left, right, up, down, etc. One of ordinary skill in the art will recognize that the various entities illustrated in FIG. 2, such as the applications 214, 228, logging service APIs 218, 230, alert facility 220, message queue 222, logstream 116, and browser 234 are preferably implemented by one or more modules in the computing environment. As used herein, "module" typically refers to machine-executable code and/or data, but may also include associated circuitry, such as processing circuitry, as well as data storage areas (e.g., magnetic disk, tape, CD-ROM, DVD, random-access memory, and/or read-only memory). Thus, it will be appreciated that each of the entities shown in FIG. 2 may be implemented by one or a combination of hardware and software. FIG. 3 is a flow chart illustrating steps performed by the logging service according to a preferred embodiment of the present invention. Those of skill in the art will recognize that the steps illustrated in FIG. 3 can be altered or performed in a different order and remain within the scope of the present invention. Upon receiving a diagnostic message in the form of a populated API block from an application, the logging service preferably validates 310 the header information in the block. A preferred embodiment of the present invention requires that certain fields in the block contain certain values before the diagnostic message is logged. Specifically, the embodiment verifies the LOG-SERVICE-NAME, LOG-MAJOR-VERSION, and LOG-MINOR-VERSION fields to ensure that the calling application has passed a valid control block. In addition, the present invention preferably checks the LOG-LONG-MSG-IND and LOG-MESSAGE-LEN-QY fields. If the former field is set to "Y", then the latter field must contain a value between one and 32000. If the LOG-MESSAGE-LEN-QY field has a value greater than 32000, then a preferred embodiment of the present invention unilaterally sets the value to zero. Alternatively, if the former field is set to "N", then the latter field must contain a value of zero. Otherwise, the control block is invalid. Ideally, every call to the logging service will pass this validation. However, incorrectly formatted diagnostic messages can result from programmer or processing errors. Accordingly, the logging service validates the headers to ensure that an incorrectly formatted diagnostic message does not get logged. An alternative embodiment of the present invention tracks the number of incorrectly formatted messages and/or separately logs such messages. In addition, one embodiment of the present invention suppresses duplicate messages from the same calling application within a predetermined time period (e.g., 60 seconds). This suppression is performed to prevent a looping application from flooding the logstream 116 with useless messages. If the API block validates, the logging service determines 316 whether there are any missing fields in the API block that can be populated by the logging service. Due to programmer error or other reasons, one or more of the fields in the API block may not be filled-in, despite the availability of the relevant information. Possible fields/information include the date/time that the message was generated, the user ID of the application, the OLTP region name where the application started, and/or the batch job name associated with the application. The logging service preferably populates 316 such fields with the missing information, if possible. The logging service also determines 318 whether the block was received from an application executing in the OLTP or batch subsystem. If the block was received from an application in the batch subsystem, then the logging service preferably writes 320 the diagnostic message directly to the logstream. After completing these steps, the logging service sends 320 a return code to the calling application indicating whether the message was successfully logged. If the logging service received the diagnostic message from an application in the OLTP subsystem, the logging service preferably writes 324 the message into the message queue. As described above, a drain process preferably reads the messages from the message queue and writes them to a log in the logstream (this interaction is not shown in FIG. 3). The logging service also checks the message to determine 326 whether to notify the alert service. If the appropriate field in the API block is set, then the logging service calls 328 the alert service and passes it the relevant fields in the API block. After the alert service is called, or if the logging service does not notify the alert service, the logging service sends 322 a return code to the calling application. The above description is included to illustrate the operation of the preferred embodiments and is not meant to limit the scope of the invention. The scope of the invention is to be limited only by the following claims. From the above discussion, many variations will be apparent to one skilled in the relevant art that would yet be encompassed by the spirit and scope of the invention.
|
Same subclass Same class Consider this |
||||||||||
