As you roll out more and more Valence apps to your IBM i users, it's only a matter of time before you receive a call from someone claiming a program didn't respond with the expected data, or took too long to respond. Or perhaps it didn't respond at all!
Of course, getting pertinent cause-and-effect details from users in these cases can sometimes be rather challenging. Information such as "Which button did you click?" or "What did you type in?" is often surprisingly hard to come by. Fortunately, Valence includes a configurable logging feature that fills in where your users tend to leave off.
With some simple configurations, Valence will automatically record all pertinent data moving between the front-end user interface and your back-end RPG programs. In addition to assisting with understanding what's happening inside your apps, this collection of evidence is also useful for identifying RPG programs or SQL statements that are running sluggishly.
The log file, called VVCALLLOG, is located in your Valence library. Depending on how you have your Valence instance configured, recorded elements for each AJAX call can include:
- The session ID
- The RPG program initially called
- The time the call was made
- The time the call completed
- The total duration of the call
- The app ID
- Job and user info
- The parameters passed to the RPG program
- The JSON response to the front-end
To activate the AJAX call logging, go into the Portal Admin app and scroll down to the "Log Settings" section, where you should see something like this:
The meanings behind these settings are as follows:
- Log each program call from browser - this must be checked for VVCALLLOG to be populated with basic information on each call (excludes post and response data). If this box is not checked, no data will be logged.
- Log all post data passed in from browser - when this is checked, all posted parameters passed to your various RPG programs will be logged in a field called LOGPOST.
- Log all data sent to browser - when this is checked, all response data from your RPG programs will be logged in a field called LOGRESP.
- Days to retain log information - with each AJAX call logging a record, the VVCALLLOG file can fill up rather quickly. This value controls how long (in days) data should remain in the file. The default is for data to be purged after 14 days.
Once logging is activated, you should quickly see useful data accumulating in VVCALLLOG, something like this:
With this data available, you can use any file editor or query utility to inspect the contents in VVCALLLOG and identify what your various RPG programs did in response to every AJAX call made. You might also want to periodically inspect this file to look for programs that appear to be taking an excessive time to process and send data back to the user. As a general rule of thumb, any calls routinely taking much longer than a second or two to respond (1000 or 2000 milliseconds) might warrant further investigation. In such cases a new SQL index or adjustment to the RPG program logic may result in a snappier experience for your users.