com.lutris.logging
Class Logger
java.lang.Object
com.lutris.logging.Logger
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.
- Author:
- Mark Diekhans
- 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. |
Method Summary |
abstract void |
configure(com.lutris.util.Config logConfig)
Configure Logger with given config section |
abstract void |
configure(java.lang.String confFilePath)
Configure Logger with given config file, interpreting of config file is
logger implementation specific. |
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 |
EMERGENCY
public static final int EMERGENCY
- Standard level for urgent condition that requires immediate attention
and indicates that the system is no longer functioning.
- See Also:
- Constant Field Values
ALERT
public static final int ALERT
- A condition that should be corrected immediately
- See Also:
- Constant Field Values
CRITICAL
public static final int CRITICAL
- Critical conditions.
- See Also:
- Constant Field Values
ERROR
public static final int ERROR
- Errors that have been correctly handled.
- See Also:
- Constant Field Values
WARNING
public static final int WARNING
- Warning messages.
- See Also:
- Constant Field Values
NOTICE
public static final int NOTICE
- Conditions that are not error conditions, but should possi bly be
handled specially.
- See Also:
- Constant Field Values
INFO
public static final int INFO
- Informational messages.
- See Also:
- Constant Field Values
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.
- See Also:
- Constant Field Values
DEBUG1
public static final int DEBUG1
- Debug detail level 1.
- See Also:
- Constant Field Values
DEBUG2
public static final int DEBUG2
- Debug detail level 2.
- See Also:
- Constant Field Values
DEBUG3
public static final int DEBUG3
- Debug detail level 3.
- See Also:
- Constant Field Values
DEBUG4
public static final int DEBUG4
- Debug detail level 4.
- See Also:
- Constant Field Values
DEBUG5
public static final int DEBUG5
- Debug detail level 5.
- See Also:
- Constant Field Values
DEBUG6
public static final int DEBUG6
- Debug detail level 6.
- See Also:
- Constant Field Values
DEBUG7
public static final int DEBUG7
- Debug detail level 7.
- See Also:
- Constant Field Values
DEBUG8
public static final int DEBUG8
- Debug detail level 8.
- See Also:
- Constant Field Values
DEBUG9
public static final int DEBUG9
- Debug detail level 9.
- See Also:
- Constant Field Values
DEBUGTMP
public static final int DEBUGTMP
- Temporary debugging; should not be left in shipping code.
- See Also:
- Constant Field Values
MAX_STD_LEVEL
public static final int MAX_STD_LEVEL
- Largest fixed logging level.
- See Also:
- Constant Field Values
centralLogger
protected static Logger centralLogger
- Global
Logger
object.
standardLevelNames
protected static final java.lang.String[] standardLevelNames
- Table of standard level names
Logger
public Logger()
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.
configure
public abstract void configure(java.lang.String confFilePath)
throws ConfigException
- Configure Logger with given config file, interpreting of config file is
logger implementation specific.
- Parameters:
confFilePath
- Path to configuration file.
- Throws:
ConfigException
configure
public abstract void configure(com.lutris.util.Config logConfig)
throws ConfigException
- Configure Logger with given config section
- Parameters:
logConfig
- containing parameters for configuring logger
- Throws:
ConfigException