|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.common.log.config.BasicLogConfiguration
public class BasicLogConfiguration
Basic, default implementation of the LogConfiguration interface. This
class contains the int
logging level, as well as a Collection
of String discarded contexts (logging contexts which will not be
logged.) This class also contains static final String constants
specifying the two property names whose values completely describe a
LogConfiguration, plus static utility methods for converting a
LogConfiguration object to and from a Properties object representation.
Field Summary | |
---|---|
static java.lang.String |
CONTEXT_DELIMETER
This String should separate each of the contexts in the String value for the property LOG_CONTEXT_PROPERTY_NAME . |
static java.lang.String |
LOG_CONTEXT_PROPERTY_NAME
The name of the System property that contains the set of comma-separated context names for messages not to be recorded. |
static java.lang.String |
LOG_LEVEL_PROPERTY_NAME
The name of the System property that contains the message level for the LogManager. |
Constructor Summary | |
---|---|
BasicLogConfiguration()
|
|
BasicLogConfiguration(java.util.Collection contexts,
int msgLevel)
|
|
BasicLogConfiguration(int msgLevel)
|
|
BasicLogConfiguration(LogConfiguration currentLogConfig)
|
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone the object. |
int |
compareTo(java.lang.Object obj)
Compares this object to another. |
static LogConfiguration |
createLogConfiguration(java.util.Properties props)
Creates a non-null LogConfiguration from the given properties. |
void |
discardContext(java.lang.String context)
Specify that messages with the input context should be discarded and not recorded. |
void |
discardContexts(java.util.Collection contexts)
Direct the log configuration to discard the given contexts and not record them. |
boolean |
equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. |
java.util.Set |
getDiscardedContexts()
Obtain the set of contexts for messages that are to be discarded. |
static java.util.Properties |
getLogConfigurationProperties(LogConfiguration logConfiguration)
Creates a Properties object containing the two name/value pairs which define a LogConfiguration, parsed from the given LogConfiguration object. |
int |
getMessageLevel()
Get the level of detail of messages that are currently being recorded. |
boolean |
isMessageToBeRecorded(java.lang.String context,
int msgLevel)
|
void |
recordAllContexts()
Direct the log configuration to record all known logging contexts. |
void |
recordContexts(java.util.Collection contexts)
Direct the log configuration to record only these contexts. |
void |
setMessageLevel(int level)
Direct the log configuration to record messages of the given level or above. |
java.lang.String |
toString()
String representation of logging configuration. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LOG_LEVEL_PROPERTY_NAME
public static final java.lang.String LOG_CONTEXT_PROPERTY_NAME
The name of the System property that contains the set of comma-separated context names for messages not to be recorded. A message context is simply some string that identifies something about the component that generates the message. The value for the contexts is application specific.
This is an optional property that defaults to no contexts (i.e., messages with any context are recorded).
public static final java.lang.String CONTEXT_DELIMETER
LOG_CONTEXT_PROPERTY_NAME
. For example,
if this delimiter were a comma, the value for the property might
be something like "CONFIG,QUERY,CONFIGURATION_ADAPTER".
Constructor Detail |
---|
public BasicLogConfiguration(java.util.Collection contexts, int msgLevel)
public BasicLogConfiguration()
public BasicLogConfiguration(int msgLevel)
public BasicLogConfiguration(LogConfiguration currentLogConfig)
Method Detail |
---|
public static LogConfiguration createLogConfiguration(java.util.Properties props) throws LogConfigurationException
Creates a non-null LogConfiguration from the given properties. A
LogConfiguration with default behavior (using default, no-arg
constructor
) is created if one or more
of the two necessary property values are missing, or if the
Properties parameter is null.
The two properties are
LOG_LEVEL_PROPERTY_NAME
and
LOG_CONTEXT_PROPERTY_NAME
props
- Properties which should have values for the properties
LOG_LEVEL_PROPERTY_NAME
and
LOG_CONTEXT_PROPERTY_NAME
LogConfigurationException
- this currently is not being
thrown, but remains in the method signature because it is very
possible the implementation of this method may change. It should
be noted that if any unexpected error happens (such as an invalid
property value) a default LogConfiguration is created instead of
what may be expected.public static java.util.Properties getLogConfigurationProperties(LogConfiguration logConfiguration) throws LogConfigurationException
Creates a Properties object containing the two name/value pairs which define a LogConfiguration, parsed from the given LogConfiguration object.
The two properties are
LOG_LEVEL_PROPERTY_NAME
and
LOG_CONTEXT_PROPERTY_NAME
logConfiguration
- LogConfiguration which you want a Properties
object representation of. This parameter may be null
,
in which case an empty Properties object will be returned.
null
.
Otherwise, the Properties object will have a value for the property
LOG_LEVEL_PROPERTY_NAME
, and may have a value for
the property LOG_CONTEXT_PROPERTY_NAME
, if the parameter
logConfiguration had any discarded log contexts in it.
LogConfigurationException
- this currently is not being
thrown, but remains in the method signature because it is very
possible the implementation of this method may change.public java.util.Set getDiscardedContexts()
getDiscardedContexts
in interface LogConfiguration
public void discardContext(java.lang.String context)
discardContext
in interface LogConfiguration
context
- the context to add to the set; this method does nothing
if the reference is nullpublic int getMessageLevel()
getMessageLevel
in interface LogConfiguration
public int compareTo(java.lang.Object obj)
equals()
, meaning
that (compare(x, y)==0) == (x.equals(y))
.
compareTo
in interface java.lang.Comparable
obj
- the object that this instance is to be compared to.
java.lang.IllegalArgumentException
- if the specified object reference is null
java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this instance.public boolean equals(java.lang.Object obj)
compareTo()
.
equals
in class java.lang.Object
obj
- the object that this instance is to be compared to.
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
LogConfiguration
clone
in interface LogConfiguration
clone
in class java.lang.Object
public void recordAllContexts()
recordAllContexts
in interface LogConfiguration
public void discardContexts(java.util.Collection contexts)
discardContexts
in interface LogConfiguration
contexts
- the collection of contexts that should be discarded.public void recordContexts(java.util.Collection contexts)
recordContexts
in interface LogConfiguration
contexts
- the contexts that should be recorded.public void setMessageLevel(int level)
setMessageLevel
in interface LogConfiguration
level
- the lowest level to record.public boolean isMessageToBeRecorded(java.lang.String context, int msgLevel)
isMessageToBeRecorded
in interface LogConfiguration
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |