AgentryHandler class

This is an implementation of the Java Logging API's Handler class that will route log messages to the Agentry Server Java System Connection's log file.

Syntax

public class AgentryHandler extends Handler

Members

All members of AgentryHandler, including inherited members.

Variables
Modifier and Type Variable Description
protected Formatter _defaultFormatter This is the default formatter used by this handler.
Constructors
Modifier and Type Constructor Description
public AgentryHandler() Constructs a new AgentryHandler object.
Methods
Modifier and Type Method Description
public void close() Agentry log files cannot be closed from Java; this method does nothing.
public void flush() The Agentry server always flushes its log files; this method does not do anything explicit.
protected LogLevel mapLogLevel(Level) Maps a Java log level to an Agentry log level, as described in the class documentation.
public void publish(LogRecord) Publishes a log record to the Agentry server.

Usage

It is also capable of routing messages to an Agentry user log file, if it receives objects of class UserLogRecord instead of objects of the base class LogRecord. UserLogRecord objects can be easily generated by using the UserLogger class.

Both the Java Logging API 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 the Java Logging API map to the log levels in Agentry as follows:

Java Logging API Agentry Purpose
Level#SEVERE Level 0 Severe errors, always logged
Level#WARNING Level 1 Warnings or recoverable errors
Level#INFO Level 2 "Now doing this" type messages
Level#CONFIG Level 2 Configuration settings and related messages. Note that this will map to the same Agentry level as Level.INFO messages.
Level#FINE Level 3 Details of why a decision is being made. This is the level that the Server.debug and User.debug methods will log at.
Level#FINER Level 4 Values being set from files, user input, etc; details of calculations.
Level#FINEST Level 5 Really low level details. This is the level that the AJAPI classes and the Agentry Server will log at, so if you enable this you may get a lot of log messages. Because of this, using this level in end-user code is discouraged.

Configuration:

By default each AgentryHandler is initialized using the following LogManager configuration properties:
  • com.syclo.agentry.utility.java_logging.AgentryHandler.level
  • Specifies the default level (defaults to Level#ALL).
  • com.syclo.agentry.utility.java_logging.AgentryHandler.filter
  • Specifies the name of a Filter class (defaults to no filter).
  • com.syclo.agentry.utility.java_logging.AgentryHandler.formatter
  • Specifies the name of a Formatter class to use (defaults to an internal formatter that produces just the text of the message by itself; Agentry will add a timestamp to the message when it logs it).