AgentryAppender class

AgentryAppender is a Log4j Appender that will route log messages to the Agentry Server Java System Connection's log file.

Syntax

public class AgentryAppender extends AppenderSkeleton

Members

All members of AgentryAppender, including inherited members.

Variables
Modifier and Type Variable Description
public static final String AGENTRY_USER_MDC_KEY MDC key for adding an Agentry User object to the Log4j MDC.
Constructors
Modifier and Type Constructor Description
public AgentryAppender() Constructs a new AgentryAppender object.
Methods
Modifier and Type Method Description
protected void append(LoggingEvent)  
public void close()  
protected LogLevel mapLogLevel(Level) Maps a Log4j log level to an Agentry log level, as described in the class documentation.
public boolean requiresLayout()  

Usage

It is also capable of routing messages to an Agentry user log file, if the key named by AGENTRY_USER_MDC_KEY is set to an Agentry User object in Log4j's MDC.

Both Log4j and the Agentry Server support the concept of log levels. The logging level of the Agentry Server is configured in the AgentryLogging.ini file, and the Agentry Server supports six levels, 0 through 5, with level 0 messages always being logged. For each system connection, there is a level setting in the configuration file, and all messages at or below that setting will be logged.

The levels in Log4j map to the log levels in Agentry as follows:

Log4j Agentry Purpose
Level.FATAL, Level.ERROR Level 0 Severe errors, always logged
Level.WARN Level 1 Warnings or recoverable errors
Level.INFO Level 2 "Now doing this" type messages
Level.DEBUG Level 3 Details of why a decision is being made.
Level.TRACE Level 4 Values being set from files, user input, etc; details of calculations

Note that there is currently no Log4j level that corresponds to log level 5 in Agentry. That log level is generally used by very low-level logging in the Agentry Server itself, so its use in end-user applications would be discouraged anyways.

AgentryAppender supports the basic settings used by other Log4j appenders, including layouts. It is not required to have a layout configured for the appender; if no layout is configured, then messages will be sent directly to Agentry with no special formatting.

NOTE: If you want to use this class you must have Log4j on your Agentry server's class path, as configured in Agentry.ini. Log4j is not distributed with the Agentry Server. It can be obtained from the Apache Log4j web site. This appender is intended for use with Log4j 1.2.x; it may work with later versions, but there is no guarantee.