Enabling Logging
This page describes how to enable logging that records CSP activity, which is useful for troubleshooting CSP-based web applications.
Enabling and Disabling Logging
Enable logging by entering the following command in the Terminal:
Set ^%ISCLOG = 2
You can view logging information in the ^ISCLOG global.
You can turn logging off with either of the following commands:
Set ^%ISCLOG = 0
Kill ^%ISCLOG
Log Levels
For reference, the log levels are as follows:
-
0 — InterSystems IRIS® performs no logging.
-
1 — InterSystems IRIS logs only exceptional events (such as error messages).
-
2 — InterSystems IRIS logs detailed information, such as method ABC invoked with parameters X,Y,Z and returned 1234.
-
3 — InterSystems IRIS logs raw information such as data received from an HTTP request.
ISCLog Details
In ISCLOG, some entries match Event Log header fields as follows:
ISCLOG | Event Log |
---|---|
Job | Cache-PID |
SessionId | Session-ID |
Tag | Request-ID |
Fields and definitions in ISCLOG are shown in the table below.
Field | Definition |
---|---|
%category |
CSPServer: Logged from cspServer, cspServer2, %request, %response. |
CSPSession Logged from %session and parts of cspServer and cspServer2 which handle a session. This allows watching the lifecycle of a session. |
|
CSPLicenseLogged from parts of cspServer and cspServer2 which handle a licensing. |
|
Gateway RequestLogged from the GatewayMgr, GatewayRegistry, the Gateway request handler and parts of cspServer2 which handle gateway requests. |
|
%level |
1= Exceptions and errors. |
2=CSPSession information. CSPLicense information. Information from cspServer: the part of the request handling after the %response, %session, and %request have been setup. This includes authentication, license handling, redirection, and calling the CSPpage. |
|
3=Information from cspServer2: the part of handling the request which sets up the %response, %session, %request, and hand-shaking/data transfer with the Web Gateway. |
|
%job | The value of $job when the ISCLOG request was made. Matches the Cache-PID field from the Event Log header. |
%sessionid |
Entered when available. The value of sessionid at the time the ISCLOG request was made. Matches the Session-ID field from the Event Log header. |
%tag | For the CSP Server, the tag contains the Request id from the gateway (when available). This matches the Request-ID field from the Event Log header. Other loggers may set this value to any value.
Available for use by creators of ISCLOG entries. Stores ID of the request sent to it by the Web Gateway. It can be used as a filter for generation of ISCLOG entries. Set ^%ISCLOG("Tag","mytagvalue1")=1 Set ^%ISCLOG("Tag","mytagvalue2")=1 Only ISCLOG requests with no tag or with tags of "mytagvalue1" or "mytagvalue2" will be recorded. |
%routine | The name of the routine currently being executed. |
%message | See Message Format below. |
Message Format
Messages start with the name of the tag label or method currently being executed. This name is enclosed in square brackets. [MyMethod] rest of messages.
Messages in the CSPSession category also have CSPSession-Id=sessid after the method name. This is needed as session events can be logged before the session is created or after it was destroyed, meaning the SessionId field is empty in the ISCLOG entry.
[MyMethod] CSPSession-Id: 12ty34ui22
Messages in the GatewayRegistry category also have CSPID=cspid(when available) after the method name. This allows the tracking of an individual gateway request from the API call through the Gateway Request Handler.
[MyMethod]CSPID:334r43345 rest of message