Logging MathLM

Enabling Logging

You can enable logging in two ways.

The log file records messages as they occur, building up a detailed record of license activity over a period of time.

Logging supports both IPv4 and IPv6 environments with no additional configuration required.

Syntax of the Log File

By default, MathLM generates all log files in the W3C Common Logfile Format used by web servers such as Apache. However, you can customize the format by using the option -logformat. This option takes a string argument that specifies the format in which server messages are displayed. The string contains a series of commands of the form %var#, where

For example, %y1 means that the year is displayed in two-digit format (e.g., 10), while %y2 displays the year in four-digit format (e.g., 2010).

In addition to the %var# commands, the string can also include plain text such as brackets, dashes, quotation marks, and arbitrary comments. The text can be used to include comments and separators in the server messages for formatting purposes. All text included in the string appears literally in the server message with the following two exceptions: use %q to include a double quote ("), and use %% to include a percentage sign (%).

You must specify the type of messages that should be logged using the option -loglevel, as explained in "Launching MathLM".

Here is a list of variables that can be included in the string, along with their numeric values and formats.

MathLM logging variables.

Samples and Behavior

Running the command mathlm -logfile log.txt, without the option -logformat, generates messages in the default format. An example of messages in the default format, as contained in log.txt, follows.

hostname.domain.com - username [01/Sep/2010:22:01:35] "MathLM 8.0 executable launched" ".\mathlm" -
hostname.domain.com - username [01/Sep/2010:22:01:35] "Verbosity level specified" "1" -
hostname.domain.com - username [01/Sep/2010:22:01:35] "Logging verbosity level specified" "3" -
hostname.domain.com - username [01/Sep/2010:22:01:35] "Hostname" "hostname.domain.com" -

The default format string, which mimics the Common Logfile Format, can be invoked by the following.

%h3 - %u2 [%d/%m2/%y2:%t2 %t3] %q%e2%q %q%r2%q -

To specify the Common Logfile Format manually, you must specify this string as the value of the -logformat option, as in the following command. The messages generated by this command are in the same format as the previous example.

mathlm -logfile log.txt -logformat "%h3 - %u2 [%d/%m2/%y2:%t2 %t3] %q%e2%q %q%r2%q -"

By default, time is displayed in GMT. If you want local time to be displayed instead, you must use the -localtime command-line option with either the %t1 tag or the %t2 tag. The %t3 tag should not appear in the format string if you want local time to be displayed.

An alternate format string using local time follows.

mathlm -logfile log.txt -localtime -logformat "%h1 - %u2 [%m1-%d-%y1: %t1] %q%e2%q %q%r2%q -"

An example of server messages in this user-specified format, as contained in log.txt, is displayed here.

192.168.1.9 - username [09-16-10: 04:32:51 PM] "MathLM 8.0 executable launched" ".\mathlm" -
192.168.1.9 - username [09-16-10: 04:32:51 PM] "Default (Common Logfile Format) log format specified" "%h1 - %u2 [%m1-%d-%y1: %t1] %q%e2%q %q%r2%q -" -
192.168.1.9 - username [09-16-10: 04:32:51 PM] "Verbosity level specified" "1" -
192.168.1.9 - username [09-16-10: 04:32:51 PM] "Logging verbosity level specified" "3" -
192.168.1.9 - username [09-16-10: 04:32:51 PM] "Hostname" "hostname.domain.com" -