Download Server Session Log
This article explains how to obtain the session log file of a solver session ran on an AIMMS PRO on premise.
The AIMMS log files are created by AIMMS staff and designed to be interpreted by AIMMS staff. The meaning of log entries may not be obvious. An error or warning message in the log file does NOT necessarily indicate a problem in the application.
The AIMMS project that contains the example can be
This example contains a small transport problem as an example: transporting pellets of bottled water.
Operating the example
After publishing the application, you can (by pressing the three buttons in sequence):
Solve the mathematical program.
Determine the session id of the solver session just ran.
In the example supplied, the session id of the last solver session ran is obtained via
1sp_serverSession := pro::session::CurrentSession();
pro::sessionmanager::ListSessionSinceDatealso provides a set of session id’s.
Download the session log. As the (WebUI) data session is running locally on the host of the AIMMS PRO server, it has access to this session log file.
Explaning the download code
AIMMS PRO on premise stores the session logs in the folder
The session names are part of the names of the log file.
Perhaps interesting is that using AIMMS PRO 2.34 and newer, session logs are named such that it is clear from the session name:
the type of session (solver, data, verify)
the moment started
The above is sufficient to write code to copy the session log first in the project folder, and then to download it to you download folder. This code detailed in the next section, and in the last section it is explained how to integrate in your own application.
As an admin you can trigger the elaborate naming of session log files by pressing the buttons
Restore all to defaults and
Save settings in the tab
Configuration > Log Management of the AIMMS PRO portal.
As a first step, the complete filename of the session log is determined.
1EnvironmentGetString( 2 Key : "AIMMSPRO_DATADIR", 3 Value : sp_proDataDir); 4sp_sessionLogDir := sp_proDataDir + "\\Log\\Sessions"; 5 6DirectoryGetFiles( 7 directory : sp_sessionLogDir, 8 filter : "*.log", 9 filenames : sp_filenames(i_fileNumber), 10 recursive : 0); 11 12ep_logFileNo := first( i_fileNumber | findString(sp_filenames(i_fileNumber), sp_serverSession ) ); 13if ep_logFileNo then 14 sp_baseSessionLogFilename := sp_filenames(ep_logFileNo) ; 15 sp_originalSessionLogfileLocation := sp_sessionLogDir + "\\" + sp_baseSessionLogFilename ; 16else 17 sp_originalSessionLogfileLocation := "" ; 18 raise warning "session log file for " + sp_serverSession + " not found." ; 19endif ;
Remarks on the above code:
Line 1-4: Obtain the session log folder.
line 6-10: Get a list of all session log files.
Line 12: Determine the log file that contains the session id as part of its name.
Line 14,15: Construct full path of the log file for the session at hand.
As a second step, copy the file to the project folder, then in the download template.
1pr_getSessionLogFile(sp_serverSession, sp_baseSessionLogfilename, sp_originalSessionLogfileLocation); 2fileLocation := sp_baseSessionLogfilename ; 3FileCopy( sp_originalSessionLogfileLocation, fileLocation ); 4 5sp_FileProcessSpecificFileName := webui::GetIOFilePath(FileLocation); 6if fileLocation <> sp_FileProcessSpecificFileName then 7 fileCopy( fileLocation, sp_FileProcessSpecificFileName ); 8endif ; 9 10StatusCode := webui::ReturnStatusCode('CREATED'); 11StatusDescription := "Nice.";
Remarks on the above code:
Line 1: obtain the filename of the solver session log from the session id (see the first step discussed above).
Line 3: Copy the session log file to the project folder
Line 7: Copy the session log file to the process specific temporary folder. This is the folder where files are downloaded from.
Integration in your own application
The code explained and demoed above is contained in a separate section named:
Download server session log of download offered above.
See Export code to another project for copying the code to your project.
Once you’ve copied the code, you need to add the following widgets:
button to obtain the session id,
download button to actually download the session log file.