Logging

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

For details on logging, including a cross reference to the types of message and a breakdown of the format AMPS uses in log messages, see the Logging section of the AMPS User Guide.

The following table lists the configuration elements that apply to all logging protocols:

Element

Description

Protocol (required)

Define the logging target protocol

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

Level

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

A production server should be configured to log at info level or more verbose. There is no default for this option.

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. There is no default for this option.

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. There is no default for this option.

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. There is no default for this option.

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

AMPS logging is always opt-in. That is, no messages are logged to a target by default. Logging must be explicitly requested using the configuration elements above.

The following tabs list information that is only relevant for specific protocols.

Element

Description

FileName

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

Required for file and gzip protocols.

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

RotationThreshold

Log size at which log rotation will occur. See Byte Units for details on specifying file size.

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

Last updated

Copyright 2013-2024 60East Technologies, Inc.