8. LoggingΒΆ

AMPS supports several different types of log formats, and multiple targets can be defined simultaneously.

Element Description
Protocol

Define the logging target protocol

Valid values: stdout, stderr, file, gzip, syslog

FileName

File to log to. If the protocol is gzip, then .gz is added to the file name.

Default: ${PWD}/%Y-%m-%dT%H%M%S.log

RotationThreshold Log size at which log rotation will occur. See Table 1.3 for details on specifying file size.
Level

Defines a lower bound (inclusive) log level for logging. All log messages at the specified level and up are logged.

Valid values: none, developer, trace, stats, info, warning, error, critical, emergency

Levels

A comma separated list of specific log levels. Only log messages at the specified levels will be logged. This element can be used with the Level element. In that case, the AMPS will log all messages at Level and above, and in addition, will log errors at the levels specified by Levels.

Valid values: developer, trace, stats, info, warning, error, critical, emergency, none

IncludeErrors

Additional errors that should be included when logging. If an error appears in this element, it will be logged regardless of the level of the error.

This element accepts a comma-delimited list of error numbers. You can also provide a regular expression that matches a set of errors, such as 12-.*

ExcludeErrors

Errors that should be excluded when logging. If an error appears in this element, it will not be logged regardless of the level of the error.

If the same error appears in both IncludeErrors and ExcludeErrors, ExcludeErrors takes precedence and the error will not be logged.

This element accepts a comma-delimited list of error numbers. You can also provide a regular expression that matches a set of errors, such as 12-.*

Ident

Syslog identifier for the AMPS instance.

Default: AMPS Instance Name

Options A comma separated list of syslog options. If using syslog, 60East recommends using LOG_CONS, LOG_NDELAY, and LOG_PID. AMPS uses the standard options to syslog, as described in the syslog man page.
Facility Syslog facility to use.

Table 8.1: Logging Parameters

<Logging>
    <!-- trace messages to files in /var/tmp/ -->
    <Target>
        <Protocol>file</Protocol>
        <FileName>/var/tmp/amps/logs/%Y%m%d%H%M%S-%n.log</FileName>
        <RotationThreshold>2G</RotationThreshold>
        <Level>trace</Level>
        <Levels>critical</Levels>
    </Target>
    <!-- Record critical messages to the system logger. -->
    <Target>
        <Protocol>syslog</Protocol>
        <Level>critical</Level>
        <Ident>amps_dma</Ident>
        <Options>LOG_CONS,LOG_NDELAY,LOG_PID</Options>
        <Facility>LOG_USER</Facility>
    </Target>
    <!-- record only the AMPS initialization message -->
    <Target>
        <Protocol>file</Protocol>
        <FileName>/var/tmp/amps/logs/initMessage</FileName>
        <IncludeErrors>00-0015</IncludeErrors>
    </Target>
</Logging>

Example 8.1: Logging Example