Logging MathLM

Enabling Logging

You can enable logging in two ways.

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

Note: All Windows clients on a network have the same user ID (set to the number 65535 by default). Hence, the user ID setting is only meaningful for clients running Unix, Linux, or Mac OS X.

Note: To use the GMT offset format (%t3), you must also use the -localtime option when starting MathLM.

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.

Note: Server messages in IPv6 networks will display IPv6 addresses automatically, with no additional configuration required.

Related Tutorials