Enhydra 3.0 API

com.lutris.logging
Class Logger

java.lang.Object
  |
  +--com.lutris.logging.Logger
Direct Known Subclasses:
StandardLogger

public abstract class Logger
extends java.lang.Object

A general-purpose logging facility. It is modeled after syslogd. This is a base class from which an actual implementation is derived. It only defines how log message are written by a client. Where the log message is written and the mechanism for controlling logging is left up to the implementation. This class does not define any of these mechanism and their definition is not necessary for understand how to use this class.

Each log message is associate with a facility and has a level assigned to it. A facility is a symbolic (String) name that defines a class of log messages. A level is used to indicate the It is expected that the implementation can enable, disable and direct log messages based on these attributes. Facilities and levels are defined symbolicly, with no restriction on the name, and form a tuple. Several standard levels are defined as integer constants and their use is expected to be higher performing than symbolic levels..

Normally, a single, global instance of the object is exists and is obtainable by a static method in this class.

Log messages are written via an object implementing LogChannel. A channel is associated with a single facility, with the level being specified when a message is written. Normally, a LogChannel is obtained once at initialization time and use repeatedly. It is permissible to obtain multiple references to the log channel for a facility, but this is discouraged for performance reasons.

Log messages, even debugging ones, should be defined with care. They should be terse, but clear to someone who isn't intimately familiar with the code. Permanent debugging messages should be designed with the idea of use when supportting a deployed product.

The central logging object needs to be configured very early in the startup process. If logging can't be configured, then the startup should be aborted or a object created that does some simple form of logging, such as write to stderr. A client should never have to check if the global logger object exists.

See Also:
LogChannel

Field Summary
static int ALERT
          A condition that should be corrected immediately
protected static Logger centralLogger
          Global Logger object.
static int CRITICAL
          Critical conditions.
static int DEBUG
          Messages that contain information normally of use only when debugging.
static int DEBUG1
          Debug detail level 1.
static int DEBUG2
          Debug detail level 2.
static int DEBUG3
          Debug detail level 3.
static int DEBUG4
          Debug detail level 4.
static int DEBUG5
          Debug detail level 5.
static int DEBUG6
          Debug detail level 6.
static int DEBUG7
          Debug detail level 7.
static int DEBUG8
          Debug detail level 8.
static int DEBUG9
          Debug detail level 9.
static int DEBUGTMP
          Temporary debugging; should not be left in shipping code.
static int EMERGENCY
          Standard level for urgent condition that requires immediate attention and indicates that the system is no longer functioning.
static int ERROR
          Errors that have been correctly handled.
static int INFO
          Informational messages.
static int MAX_STD_LEVEL
          Largest fixed logging level.
static int NOTICE
          Conditions that are not error conditions, but should possi bly be handled specially.
protected static java.lang.String[] standardLevelNames
          Table of standard level names
static int WARNING
          Warning messages.
 
Constructor Summary
Logger()
           
 
Method Summary
static Logger getCentralLogger()
          Get the central (global) logging object.
abstract  LogChannel getChannel(java.lang.String facility)
          Get the log channel object for a facility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMERGENCY

public static final int EMERGENCY
Standard level for urgent condition that requires immediate attention and indicates that the system is no longer functioning.

ALERT

public static final int ALERT
A condition that should be corrected immediately

CRITICAL

public static final int CRITICAL
Critical conditions.

ERROR

public static final int ERROR
Errors that have been correctly handled.

WARNING

public static final int WARNING
Warning messages.

NOTICE

public static final int NOTICE
Conditions that are not error conditions, but should possi bly be handled specially.

INFO

public static final int INFO
Informational messages.

DEBUG

public static final int DEBUG
Messages that contain information normally of use only when debugging. This is the basic level of debugging. Levels DEBUG1 through DEBUG9 are defined to allow for more detailed messages.

DEBUG1

public static final int DEBUG1
Debug detail level 1.

DEBUG2

public static final int DEBUG2
Debug detail level 2.

DEBUG3

public static final int DEBUG3
Debug detail level 3.

DEBUG4

public static final int DEBUG4
Debug detail level 4.

DEBUG5

public static final int DEBUG5
Debug detail level 5.

DEBUG6

public static final int DEBUG6
Debug detail level 6.

DEBUG7

public static final int DEBUG7
Debug detail level 7.

DEBUG8

public static final int DEBUG8
Debug detail level 8.

DEBUG9

public static final int DEBUG9
Debug detail level 9.

DEBUGTMP

public static final int DEBUGTMP
Temporary debugging; should not be left in shipping code.

MAX_STD_LEVEL

public static final int MAX_STD_LEVEL
Largest fixed logging level.

centralLogger

protected static Logger centralLogger
Global Logger object.

standardLevelNames

protected static final java.lang.String[] standardLevelNames
Table of standard level names
Constructor Detail

Logger

public Logger()
Method Detail

getCentralLogger

public static Logger getCentralLogger()
Get the central (global) logging object.
Returns:
A reference the object. If the facility has not been initialized null is returned. However, this is considered a bug in the design of the initialization. Clients do not need to check for null.

getChannel

public abstract LogChannel getChannel(java.lang.String facility)
Get the log channel object for a facility. For a given facility, the same object is always returned.
Parameters:
facility - Facility the channel is associated with.

Enhydra 3.0 API