Runtime Messages and Log Files

All Uniface applications can be configured to create log files that collect runtime messages generated during the application session. The messages may be generated by ProcScript commands in your application, or by Uniface to document actions, events, warnings and errors. You can configure which Uniface runtime messages are reported.

During development and testing, messages in log files are useful for debugging purposes. In a production environment, log files can be used to monitor application activity. However, if too much information is logged, this can negatively affect performance, so you need to find a balance between the information monitored and the impact it has performance.

Runtime Messages

Runtime messages can include:

  • Errors, warnings, and information messages.
  • I/O activity and other events, as determined by the message level. The message level is a number that represents one or more categories of information, such as network messages, operation activations, or I/O requests. For more information, see I/O Message Levels.

    To control the type of events that are logged, you can set the message level in ProcScript (using $ioprint), in the assignment file (using $IOPRINT), in the startup shell, or when starting the application (using /pri). For more information, see $ioprint, $IOPRINT. and /pri.

  • Messages explicitly set by the $putmess and putmess ProcScript instructions. For more information, see $putmess , putmess and clrmess.

Message Frame and Transcript Window

By default, messages are reported to the Uniface message frame, which is available to interactive desktop applications (including the Uniface IDE, Uniface Router Monitor, and Debugger). To display the message frame, press Gold + M (or Ctrl + M).

If the message frame is not available, they are reported to the transcript window. This window is opened when initializing an application, and when running applications in batch mode (for example, when using the Uniface IDE command line interface to compile or import). It is closed automatically unless there is a problem, such as an error in the assignment file or a network error. In this case, the transcript window must be closed manually. This behavior is useful when running Uniface in batch mode because Uniface usually stays active until the transcript window is closed.

The message frame and transcript window are not available for the Uniface Router or Uniface Server, or for web and mobile application. For these applications, messages can be directed to log files.

Application Log Files

If logging is enabled, messages are also copied to log files.

To enable logging, edit the application's assignment file and specify the log file name and location using the $PUTMESS_LOG_FILE setting (for the message frame) and/or $TRANSCRIPT_LOG_FILE setting (for the transcript window).

For example:

[SETTINGS]
$PUTMESS_LOG_FILE="C:\uniface\logs\myapp.log"
$IOPRINT=3

For more information, see $PUTMESS_LOG_FILE and $TRANSCRIPT_LOG_FILE.

Uniface Router and Server Log Files

For Uniface Routers and Uniface Servers, logging is enabled by default, with messages collected in a file with the application name and process ID, for example urouter02093.log or userver01234.log.

When debugging Uniface Routers and Uniface Servers, it can be useful to start them with /pri=64 (or higher). This ensures that assignment file or network errors, which can occur after the application has been started but before the assignment file is read, are logged.

The default log files are written to the working directory (as specified by the /dir switch on the Uniface Server's command line or UST definition in urouter.asn), or to the \bin folder of the Uniface installation.

If no errors are encountered, the log file and message level are reset to the values specified by $PUTMESS_LOG_FILE and $IOPRINT in the assignment file (if they are present). If $PUTMESS_LOG_FILE is specified, the default log file is closed and the specified log file is then used. Otherwise the default log file continues to be used.

Rotating Log Files

When setting $PUTMESS_LOG_FILE and $TRANSCRIPT_LOG_FILE you can add optional parameters that enable you to use rotating log files.

For example:

[SETTINGS]
$PUTMESS_LOG_FILE=$PUTMESS_LOG_FILE="C:\uniface\logs\myapp.log",	totalsize=15, count=10
$IOPRINT=67

The first and most recent file always has the name specified in the assignment setting. When the current log file reaches a maximum size (totalsize÷count), the file is renamed by adding a sequential number to the name. This is repeated until a specified maximum number of log files is reached (count), and then the oldest is deleted as new log files are created. As files are renamed, any existing file with that name is deleted.

Related Topics