NetPhantom provides means to create custom log entries directly from an application. This allows for a very flexible way of collecting information from the clients. The log is run as a single server instance and is accessed by clients through applications implementing the program logging functionality.
The log is controlled directly in Java or REXX code. The following commands are available.
StartLog() - Start the logging. All entries generated after this will be logged.
StopLog() - Stop the logging. Entries generated after this will be ignored.
LogMsg('Message to be put in log') - The structured string to be put in the log.
RotateLog() - Force the log to be rotated, if configured as possible to rotate.
All commands return 0 if successful. 1 indicates a problem; logging not active for LogMsg or logging not configured for all commands.
Please note that this means that starting and stopping the program logging means that this will effect all users/applications running on the server. There is only one instance of the program logging function on the server. The StartLog/StopLog/RotateLog commands should be seen as management tools.
The following variables are available when composing the message.
All variables are converted into string format to be used in when composing the structured message.
(The arguments can be escaped with an extra % sign; "%%P" is converted to "%P")
To enable the program logging functionality, the following line should be entered in the [Base] section of the server.ini file of the server to host the logging:
In the first case, the log file will be located in the installation directory of the NetPhantom Server. In the second case, the log file will be placed in the path indicated (under Windows: C:/example_path/).
If the logs should be automatically rotated, there are two alternatives:
This will create a log file named yy-mm-dd-name.log (example: 11-07-22-name.log) in the alternative path, if indicated. A new log with a new name will be automatically created when the dates shift and new log entries will be put there.
This will create two log files: name1.log and name2.log. They will be rotated when the size of the file reaches the indicated 300 (KB). Any entries remaining in the file that is rotated to will be deleted.
The two rotation modes are mutually exclusive. If both are configured, the rotate date alternative is used. Programmatically rotating the log files is only possible in the case where size rotation is configured.
The encoding of the log entries when they are written to file can be configured.
If encoding is not configured, 8859_1 is used by default.