|
|||||||||
| Home >> All >> konspire >> common >> [ log overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
konspire.common.log
Class Log

java.lang.Objectkonspire.common.log.Log
- Direct Known Subclasses:
- MultiThreadLog
- public class Log
- extends java.lang.Object
Log is the base class which defines
all of the logging constants and implements any
general logging responsibilities. It dispatches the actual
logging information over to a concrete subclass of
AbstractLoggingMechanism to do the work of writing
out the log information.
This class could be extended to do application-specific behavior,
or better yet you could create a class "wrapper" like AppLog
to make instances well-known Singletons with handy static/class methods.
- Version:
- $Revision: 1.3 $
| Field Summary | |
static int |
CRITICAL_ERROR_LEVEL
The system encountered a critical error at this logging level, which affects the accuracy, integrity, reliability, or capability of the system. |
protected int |
currentLoggingLevel
Keep the logging level the log is currently operating at. |
protected java.util.Date |
dateOpened
Keeps the date the log opened |
static int |
DEACTIVATE_LEVEL
Turns the log off, no messages are logged |
static int |
DETAIL_LEVEL
Moderately detailed logging level to be used to help debug typical problems in the system. |
static int |
ERROR_LEVEL
The system encountered an unexpected error at this logging level, which probably means the code intercepted an error it cannot handle. |
static int |
INFO_LEVEL
Normal logging level. |
protected java.lang.String |
logFieldSeparator
Keeps a string demarking fields within the log file. |
protected java.util.Vector |
loggingMechanisms
Keeps a collection of logging mechanisms to use when writing out the log. |
protected java.lang.String |
name
Keeps the name of the Log instance. |
static java.lang.String |
SHARED_DATED_FILE_MECHANISM
Logging mechanism to log all messages to a shared file for any Log instances using this mechanism. |
static java.lang.String |
SHARED_FILE_MECHANISM
Logging mechanism to log all messages to a shared file for any Log instances using this mechanism. |
static java.lang.String |
STANDARD_ERR_MECHANISM
Logging mechanism to log all messages to System.err |
static int |
TRACE_LEVEL
Most detailed logging level. |
static java.lang.String |
UNIQUE_DATED_FILE_MECHANISM
Logging mechanism to log all messages to a unique file specific to that Log instance. |
static java.lang.String |
UNIQUE_FILE_MECHANISM
Logging mechanism to log all messages to a unique file specific to that Log instance. |
static int |
WARNING_LEVEL
The system encountered an expected error situation. |
| Constructor Summary | |
protected |
Log()
Class constructor to properly create and register a new log. |
|
Log(java.lang.String name)
Public constructor to register a new log with a particular name. |
| Method Summary | |
AbstractLoggingMechanism |
addLoggingMechanism(java.lang.String loggingMechanismName)
Adds a Logging Mechanism to the list of mechanisms that this log writes to. |
protected void |
finalize()
Must close the log for the application if the application did not or could not. |
java.util.Date |
getDateOpened()
Return the date the log was opened, only valid if the log is currently open. |
java.lang.String |
getLogFieldSeparator()
Gets the string that delimits the various fields of a log entry |
int |
getLoggingLevel()
Gets the logging level of the current log. |
AbstractLoggingMechanism |
getLoggingMechanism(java.lang.String loggingMechanismName)
If a logging mechanism of the type input is in effect for this log, return the logging mechanism instance matching the name given as input. |
java.util.Vector |
getLoggingMechanisms()
Returns a Vector of logging mechanisms
currently active for the log. |
java.lang.String |
getName()
Return the name of the log, usually passed in by the constructor. |
boolean |
isOpen()
Return whether the log is open (is not deactivated). |
void |
logString(java.lang.String logString,
int loggingLevel)
Adds a message string to the log if the log's level is currently set at or above the loggingLevel passed in. |
void |
removeAllLoggingMechanisms()
Removes all Logging Mechanisms from the list of mechanisms that this log writes to. |
void |
removeLoggingMechanism(java.lang.String loggingMechanismName)
Removes an active Logging Mechanism from the list of mechanisms that this log writes to. |
void |
setLogFieldSeparator(java.lang.String logFieldSeparator)
Sets the string that delimits the various fields of a log entry |
void |
setLoggingLevel(int newLoggingLevel)
Changes the logging level of the current log. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DEACTIVATE_LEVEL
public static final int DEACTIVATE_LEVEL
- Turns the log off, no messages are logged
- See Also:
- Constant Field Values
CRITICAL_ERROR_LEVEL
public static final int CRITICAL_ERROR_LEVEL
- The system encountered a critical error at this logging level,
which affects the accuracy, integrity, reliability, or
capability of the system. Someone should be paged to address
the error as soon as possible.
- See Also:
- Constant Field Values
ERROR_LEVEL
public static final int ERROR_LEVEL
- The system encountered an unexpected error at this logging level,
which probably means the code intercepted an error it cannot handle.
This error is not of a critical nature and can be recovered from
automatically.
Someone should probably be emailed to resolve the error in the near
future to increase the reliability of the product.
- See Also:
- Constant Field Values
WARNING_LEVEL
public static final int WARNING_LEVEL
- The system encountered an expected error situation. The system
recovered from it but the fact that it happened should be recorded
to see how frequent it happens.
- See Also:
- Constant Field Values
INFO_LEVEL
public static final int INFO_LEVEL
- Normal logging level. All interesting periodic events should
be logged at this level so someone looking through the log can
see the amount and kind of processing happening in the system.
- See Also:
- Constant Field Values
DETAIL_LEVEL
public static final int DETAIL_LEVEL
- Moderately detailed logging level to be used to help debug
typical problems in the system. Not so detailed that the
big picture gets lost.
- See Also:
- Constant Field Values
TRACE_LEVEL
public static final int TRACE_LEVEL
- Most detailed logging level. Everything
sent to the log will be logged. Use this level to
trace system execution for really nasty problems.
- See Also:
- Constant Field Values
STANDARD_ERR_MECHANISM
public static final java.lang.String STANDARD_ERR_MECHANISM
- Logging mechanism to log all messages to System.err
UNIQUE_FILE_MECHANISM
public static final java.lang.String UNIQUE_FILE_MECHANISM
- Logging mechanism to log all messages to a unique file
specific to that
Loginstance. Reuse the same log file name (append to it) if it already exists.
UNIQUE_DATED_FILE_MECHANISM
public static final java.lang.String UNIQUE_DATED_FILE_MECHANISM
- Logging mechanism to log all messages to a unique
file specific to that
Loginstance. Don't append to an existing log, instead create a new one with a date stamp.
SHARED_FILE_MECHANISM
public static final java.lang.String SHARED_FILE_MECHANISM
- Logging mechanism to log all messages to a shared
file for any
Loginstances using this mechanism. Append to an existing log, if it already exists.
SHARED_DATED_FILE_MECHANISM
public static final java.lang.String SHARED_DATED_FILE_MECHANISM
- Logging mechanism to log all messages to a shared file
for any
Loginstances using this mechanism. Don't append to an existing log, instead create a new one with a date stamp.
name
protected java.lang.String name
- Keeps the name of the Log instance.
currentLoggingLevel
protected int currentLoggingLevel
- Keep the logging level the log is currently operating at.
loggingMechanisms
protected java.util.Vector loggingMechanisms
- Keeps a collection of logging mechanisms to use when
writing out the log.
dateOpened
protected java.util.Date dateOpened
- Keeps the date the log opened
logFieldSeparator
protected java.lang.String logFieldSeparator
- Keeps a string demarking fields within the log file.
| Constructor Detail |
Log
protected Log()
- Class constructor to properly create and register a new log. All other
constructors and subclasses should eventually call this method!
Log
public Log(java.lang.String name)
- Public constructor to register a new log with a particular name.
The name of the log is very important. It is used as a key into
the log properties file to find settings for how the log is to
be opened.
| Method Detail |
getLoggingLevel
public int getLoggingLevel()
- Gets the logging level of the current log.
setLoggingLevel
public void setLoggingLevel(int newLoggingLevel)
- Changes the logging level of the current log.
Use this method to activate, deactivate, or change the logging
detail level of an active log.
getLoggingMechanisms
public java.util.Vector getLoggingMechanisms()
- Returns a
Vectorof logging mechanisms currently active for the log.
getLoggingMechanism
public AbstractLoggingMechanism getLoggingMechanism(java.lang.String loggingMechanismName)
- If a logging mechanism of the type input is in effect for this log,
return the logging mechanism instance matching the name given as
input.
addLoggingMechanism
public AbstractLoggingMechanism addLoggingMechanism(java.lang.String loggingMechanismName)
- Adds a Logging Mechanism to the list of mechanisms that this
log writes to. Opens the mechanism and registers it also.
removeLoggingMechanism
public void removeLoggingMechanism(java.lang.String loggingMechanismName)
- Removes an active Logging Mechanism from the list of mechanisms that this
log writes to. Closes the mechanism and deregisters it also.
removeAllLoggingMechanisms
public void removeAllLoggingMechanisms()
- Removes all Logging Mechanisms from the list of mechanisms that this
log writes to. Closes the mechanisms and deregisters them also.
logString
public void logString(java.lang.String logString, int loggingLevel)
- Adds a message string to the log if the log's level is
currently set at or above the loggingLevel passed in.
finalize
protected void finalize()
throws java.lang.Throwable
- Must close the log for the application if the application did not or
could not.
getLogFieldSeparator
public java.lang.String getLogFieldSeparator()
- Gets the string that delimits the various fields of a log entry
setLogFieldSeparator
public void setLogFieldSeparator(java.lang.String logFieldSeparator)
- Sets the string that delimits the various fields of a log entry
getName
public java.lang.String getName()
- Return the name of the log, usually passed in by the constructor.
isOpen
public boolean isOpen()
- Return whether the log is open (is not deactivated).
getDateOpened
public java.util.Date getDateOpened()
- Return the date the log was opened, only valid if the log is
currently open.
|
|||||||||
| Home >> All >> konspire >> common >> [ log overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
konspire.common.log.Log