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

Documentation / Mathematica / Getting Started / Network SysAdmin Guide / The Mathematica License Manager / Monitoring License Activity /

5.4.2 Customizing the Log File

Syntax of the Log File

The new version of MathLM enables you to customize the format of messages produced by the license server. By default, all log files are generated using the W3C Common Logfile Format used by web servers such as Apache. However, you can modify the format using the option -formatlog. 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., 03), while %y2 displays the year in four-digit format (e.g., 2003).

In addition to the %var# commands, the string can also include plain text such as brackets, dashes, quotation marks, and so on, as well as arbitrary comments. The text can be used to include comments and separators in the server messages. 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 -verbose, as explained in Section 5.3.

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

%h#

Host

1 - IP address

2 - Hostname

3 - Fully qualified domain name

%u#

User

1 - User ID

2 - Username

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 or Mac OS X.

%d

Day of month

[ 1 ... 31 ]

%w#

Day of week

1 - Numeric [ 1 ... 7 ]

2 - Abbreviated [ Sun ... Sat ]

3 - Verbose [ Sunday ... Saturday ]

%m#

Month

1 - Numeric [ 1 ... 12 ]

2 - Abbreviated [ Jan ... Dec ]

3 - Verbose [ January ... December ]

%y#

Year

1 - Two-digit [ 03 ]

2 - Four-digit [ 2003 ]

%t#

Time

1 - Twelve-hour (10:20:15)

2 - Twenty-four-hour (22:20:15)

3 - GMT offset (-0500)

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

%e#

Event

1 - Numeric

2 - Verbose

%r#

Response

1 - Numeric

2 - Verbose

Samples and Behavior

The default string, which mimics the Common Logfile Format, can be invoked by:

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

To specify the Common Logfile Format manually, you must specify the above string as the value of the -formatlog option.

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

An example of server messages in the above format is:

By default, time is displayed in GMT. If you want local time to be displayed instead, you must use the -localtime command-line option and the %t1 or %t2 tag instead of the GMT offset tag %t3.

The same string using local time is:

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

An example of server messages in the above format is: