This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Logging MathLM

Enabling Logging

You can enable logging in two ways.
  • Log server messages to stdout by using the option -foreground to keep mathlm in the foreground.
  • Log server messages to a specific file using the option -logfile file.
The log file records messages as they occur, building up a detailed record of license activity over a period of time.

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
  • var is a letter representing one of nine variables, such as the host, user, day, time, or event.
  • # is a number defining a specific format for the variable var.
For example, %y1 means that the year is displayed in two-digit format (e.g., 06), while %y2 displays the year in four-digit format (e.g., 2006).
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.










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.
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.