# Appdenix C. Testing and Debugging Commands

Log Central provides a number of testing and debugging utilities. This appendix describes how to:

- Generating Test Messages

- Reading the Current Intermediate Log File

## Generating Test Messages

Log Central provides a program called `msg_test` to test the flow of messages. You can observe the results of your test messages with the Message Browser of the Log Central Console. The `msg_test` utility generates a user-defined number of messages and sends them according to the settings specified in its options. You can also use `msg_test` to print performance data.

To generate test messages, run the `msg_test` command at a command prompt on the central host or a managed node, with the following syntax:

>     msg_test [-h] [-i] [-l length] [-m log_level] [-n messages]
>     [-s subsystem [subsystem]] [-t interval]

The `msg_test` command options definitions follow.

Argument | Description
--- | ---
`-h` | Displays a help message.
`-i` | Invokes the interactive mode. The `-i` option overrides the `-t` option.
`-l` `length` | Defines the message body length. The default length is 40.
`-m` `log_level` | Specifies one or more logging levels to use in the message header. `log_level` is one or more of the following: `N` - Normal (the default) `V` - Verbose `D` - Debug `S` - Special
`-n` `messages` | Defines the number of messages you want to generate. The default is 1.
`-t` `interval` | Defines the time interval, in seconds, to sleep between messages. The default is 0.
`-s` `subsystem` | Specifies the subsystem name to use in the message header. You can specify more than one subsystem. The default is `LC`. You can supply a list of subsystem names.

### Examples

This command simply generates three random messages:

>     msg_test -n 3

The following two commands are equivalent; each generates three messages. The subsystem name of the first message is `LC`, the second is `TUXEDO`, and that of the third is `LC` (because it is not specified, and thus uses the default).

>     msg_test -n 3 -s "LC TUXEDO"

>     msg_test -n 3 -s LC -s TUXEDO

## Reading the Current Intermediate Log File

The `msg_reader` utility continuously reads the current intermediate log file that the `msg_receiver` process constructs, and writes the contents of this file to the standard output stream. The data appears in `stdout` in message format (that is, in a string containing header data and body text).

The `msg_receiver` process creates a new intermediate log file every hour. The `msg_reader` process automatically switches to reading the current log file, which the `msg_server` process updates hourly. It tracks the current log file, and automatically switches to a new log file whenever the `msg_server` closes an old log file and opens a new one. The `msg_reader` process displays the contents of the intermediate log file on the standard output, allowing you to monitor the file without going through the Console.

To read the current log file, run the `msg_reader` command at a command prompt on the central host, with the following syntax:

>     msg_reader [ -e  ] [ -n  ] [ -h  ] pathname

The `msg_reader` command options definitions follow.

Argument | Description
--- | ---
`-e` | Starts writing from the end of the log file.
`-n` | Formats the logged messages before writing them. Do not use this option if you invoke the `msg_reader` along with the `log_monitor` application.
`-h` | Displays a help message.
`pathname` | Specifies the path and file name to open for reading. The `msg_reader` utility takes `pathname` as an argument, adds the extension `.cur`, and opens the resulting file for reading. The `pathname` value is the intermediate file prefix for Log Central.

### Examples

The following command invokes `msg_reader` with formatting options and opens the file named `/tmp/log1` for reading:

>     msg_reader -n /tmp/log1 &

The following command prints messages to `stdout` with formatting:

>     msg_reader -n pathname &

Use the following command to specify your own parameters:

>     msg_reader [-e] [-n] pathname &