The action log
The action log is part of the Session History. Where the Profiling information and errors as data provide deep insight into an incident, the action log provides insight into what happened before.
The action log is like any other log file, it contains the output of tracing statements.
The GuardServersession library manages these log files.
The action log is stored in .actionLog files in the sub folder tracings of the project folder.
At the end of a solver session saved in AIMMS PRO storage at /userdata/<env>/<user>/<appname>/tracings/<session-id>.actionLog.
The following is a sample small action log:
1Opening log file tracings/d942c7adf9460ee3f4f2a0de1ed0833b.actionLog at 2021-03-08 14:25:20
2This file contains the log of a data session on behalf of chris@AIMMS
32021-03-08 14:25:24:72 [info ] Enter pr_btnSolve() [51.125 Mb] in use
42021-03-08 14:25:27:55 [debug] Enter gss::LoadResultsCallBack() [51.457 Mb] in use
52021-03-08 14:25:27:60 [trace] s_trackedSessions = { d942c7adf9460ee3f4f2a0de1ed0833b, c78864a3-babf-4015-ae41-38de854fa0a3 }
62021-03-08 14:25:27:61 [debug] Leave gss::LoadResultsCallBack() [51.770 Mb] in use. Duration is 0.060 [seconds] and memory increase is 0.313 Mb.
72021-03-08 14:25:27:62 [warn ] 2021-03-08 14:25:24:00: Warning: Don't look down.
82021-03-08 14:25:27:62 [warn ] 2021-03-08 14:25:27:00: Warning: Look up, it is raining ;-).
92021-03-08 14:25:27:63 [info ] Leave pr_btnSolve() [51.895 Mb] in use. Duration is 2.910 [seconds] and memory increase is 0.770 Mb.
Remarks:
First two lines summarizing which session is logged.
The actual logging consists of three columns:
Date time, since version 1.1.1, these time stamps are in timezone UTC
Importance level of messages
The actual message
[warn]Lines 7, 8: Warnings first issued, then handled. The timestamp in the date time column is the time the warning was handled. The timestamp in the message column is the timestamp the warning was created.[info]Lines 3, 9: An action - a procedure invoked via the WebUI by the end-user. These lines are marked here.[debug]Lines 4, 6: The procedure is invoked by program logic (call back server session).[trace]Line 5: requesting and printing a bit of state is typically done at message importance level'trace'
Relevant identifiers for logging
Set gss::s_messageLevels
1Set s_messageLevels { 2 Index: i_messageLevel; 3 Definition: { 4 data { trace, debug, info, warn, error, fatal } ; 5 } 6 Comment: "The message levels for tracing""}
Here the message level
'trace'is the lowest level, and the level'fatal'is the highest level.Element parameter
gss::ep_tracingFilterlevelwith rangegss::s_messageLevelsThe tracing filter level: any log message with importance below this filter level will not be logged. At the beginning of a session, this parameter is initialized to ‘info’. So when this tracing filter level is kept at its default, messages with importance ‘debug’ or ‘trace’ will not be logged.
Note
This parameter is part of the input case sent from the data session to a solver session. Therefore, setting the logging level in the data session will affect the logging in the solver sessions.
At the beginning of a session, this parameter is initialized to
'info'. So when this tracing filter level is kept at its default, messages with importance'debug'or'trace'will not be logged.
Procedure
gss::pr_setTracinglevel(ep_newTracingFilterLevel)Use this procedure to set the gss::ep_tracingFilterlevel
Arguments:
Element parameter
ep_newTracingFilterLevel, with rangegss::s_messageLevels
Throws exceptions: None
Return value: None.
Procedure
gss::pr_logMsg(sp_message,ep_messageImportance)Writes
sp_messageto the action log file provided the importance of the messageep_messageImportanceis greater than or equal to message filter levelep_tracingFilterlevelArguments:
sp_messageAn input string parameter.ep_messageImportanceAn optional element parameter with ranges_MessageLevelsand default'trace'.
Throws exceptions: None.
Return value: None.
Procedure
gss::pr_enter(sp_procEnterTimestamp,p_procEnterMemoryInUse,ep_messageImportance,sp_logDetail)Log the entry of a procedure, including when the procedure was entered and how much memory was in use. In addition, it stores the entry time and the memory in use at entry in the output arguments
sp_procEnterTimestampandp_procEnterMemoryInUse.The techniques used by
gss::pr_enterandgss::pr_leaveare laid out in Tracing .Arguments:
sp_procEnterTimestampAn output parameter that contains the encompassing procedure entry time according to timezone'UTC'p_procEnterMemoryInUseAn output parameter that contains the amount of memory in use upon when the encompassing procedure was entered.ep_messageImportanceoptional default'debug'The importance of logging the entry of the encompassing procedure. For procedures that are actions, it is recommended to use the value'info'.sp_logDetailoptional, default: empty
Throws exceptions: None
Return value: None.
Procedure
gss::pr_leave(sp_procEnterTimestamp,p_procEnterMemoryInUse,ep_messageImportance,sp_logDetail)sp_procEnterTimestampAn input parameter that contains the encompassing procedure entry time according to timezone'UTC'p_procEnterMemoryInUseAn input parameter that contains the amount of memory in use upon when the encompassing procedure was entered.ep_messageImportanceoptional default'debug'The importance of logging the leaving of the encompassing procedure. For procedures that are actions, it is recommended to use the value'info'.sp_logDetailoptional, default: empty
Throws exceptions: None
Return value: None.
Procedure
pr_setReplicationSessionLog(bp_doReplicate)This procedure allows you to turn on/off replication of the action log to the session log.
Arguments:
bp_doReplicateWhen 1, the action log will be replicated from the action to the session log.
Set
gss::s_SettingsElements:
DownloadFolder: Override for the download folder to be used when the WinUI downloads an incident summary.
Procedure
gss::pr_setSetting(ep_setting,sp_value)Set the setting
ep_settingto valuesp_valueProcedure
gss::pr_getSetting(ep_setting,sp_value)Retrieve the setting
ep_settingand store insp_value
Recommended use
Important to what has been done, is a list of actions. Here an action is defined as: An AIMMS procedure that is invoked via the WebUI. Examples of invocations of procedures from the WebUI are:
Button press
Uponchange procedure of a data item
A menu entry, via an item menu, widget menu, primary action, or secondary action
Status bar procedure
Page property: Action upon load
Page property: Action upon leave
By having a complete log of actions of an end-user; one can try to replay what happened.
For actions, please follow the following template:
1Procedure pr_actionTemplate {
2 Body: {
3 pr_enter(sp_gssTime, p_gssMiU, ep_messageImportance: 'info');
4 block
5 ! Call procedure to do the actual work.
6 onerror ep_err do
7 gss::pr_appendError( ep_err );
8 errh::MarkAsHandled( ep_err );
9 endblock ;
10 pr_leave(sp_gssTime, p_gssMiU, ep_messageImportance: 'info');
11 }
12 Comment: "Sample action procedure"" DeclarationSection gss_logging_declarations {
13 StringParameter sp_gssTime;
14 Parameter p_gssMiU;
15 }
16 DeclarationSection error_reference_declaration {
17 ElementParameter ep_err {
18 Range: errh::PendingErrors;
19 }
20 }
21}