|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.sap.tc.logging.ExceptionHandling
|
+--com.sap.tc.logging.LogController
Controls output to logs, which stand for destinations to write log messages
to.
Log controllers are the objects you call to write messages. To this end,
log controllers provide you with methods for associating logs with them and
for controlling the actual writing of messages. In practive, however, you
deal with concrete subclasses of this abstract class, such as
Location for trace messages or Category for log messages.
As the signatures of the methods to emit messages depend on these concrete
classes, we have furnished them rather than log controllers with these
methods, so there are no abstract output methods.
When you call an output method, the actual writing of the message to a log
depends on the severities of the message at hand, the log
controller and the logs attached to it, as well as optional
filters associated with the latter two. Typical severities are
error and warning, and you can find constants for all
the possible severities in the class Severity. Messages which
have at least the effective severity of the controller are
candidates for output and are forwarded to the logs attached to
the controller with the method addLog(Log). Beforehand, however,
filters get the chance to veto the decision on basis of the internal
message representation, the LogRecord.
Log controllers are automatically ordered into hierarchies. Hierarchies of
controllers are built up according to the hierarchical naming schemes of
the concrete subclasses of LogController. A child log
controller inherits some properties from its parent, for example its
severity and its logs. The effective severity of a child log controller is
calculated from its minimum and maximum severities, as
well as the effective severity of its parent. Most of the time you will
have no need for these two severities. Instead you will either use the
setting inherited from the parent controller or override the parent setting
with an explicit effective value for the child. To do the latter, call the
method setEffectiveSeverity(int) with the effective value you
would like to have logged.
Time and again, however, you will want to use a more elaborate scheme to
control severities, and have different minimum and maximum severities set
with calls to setMinimumSeverity(int) and
setMaximumSeverity(int), respectively. With the minimum severity
you specify the severity that messages must have at the least to be output
via the child log controller. That is, if the effective severity of the
parent log controller is higher than the minimum severity of the child than
the latter inherits the parent's effective severity, otherwise it is set to
the minimum severity. On the other hand, you specify the severity that
messages must have for output to be guaranteed, save intervention from
filters, using the maximum severity. That is, if the effective severity of
the parent log controller is lower than the maximum severity of the child
than the latter inherits the parent's effective severity, otherwise it is
set to the maximum severity. This implies that if both minimum and maximum
severity are set to the same value the effective severity gets that value
regardless of the effective severity of the parent. Such a setting is
therefore called dominant. For root log controllers the setting
must be dominant, as separate minimum and maximum values are meaningless
without a parent to inherit from.
Please find fundamental information about the principles of error handling
in the package description. In the case of this class, if a value is out of
range for one of the calls dealing with severities, the methods
ExceptionHandling.getException() and ExceptionHandling.throwException() are served with a
java.lang.IllegalArgumentException.
Log,
LogRecord,
Severity,
Filter| Method Summary | |
void |
addFilter(Filter filter)
Adds another filter that, besides the effective severity, controls output via this log controller. |
void |
addLocalLog(Log log)
Adds another local log for this log controller to write messages to. |
void |
addLog(Log log)
Adds another log for this log controller to write messages to. |
void |
addPrivateLog(Log log)
Adds another private log for this log controller to write messages to. |
boolean |
beDebug()
Same as beLogged(int)
but always checks for a debug message, that is a message with severity
Severity.DEBUG. |
boolean |
beDebug(LogController relative)
Same as beLogged(int,
LogController)
but always checks for a debug message, that is a message with severity
Severity.DEBUG. |
boolean |
beDebug(LogController[] relatives)
Same as beLogged(int,
LogController[])
but always checks for a debug message, that is a message with severity
Severity.DEBUG. |
boolean |
beError()
Same as beLogged(int)
but always checks for an error message, that is a message with severity
Severity.ERROR. |
boolean |
beError(LogController relative)
Same as beLogged(int,
LogController)
but always checks for an error message, that is a message with severity
Severity.ERROR. |
boolean |
beError(LogController[] relatives)
Same as beLogged(int,
LogController[])
but always checks for an error message, that is a message with severity
Severity.ERROR. |
boolean |
beFatal()
Same as beLogged(int)
but always checks for a fatal error message, that is a message with
severity
Severity.FATAL. |
boolean |
beFatal(LogController relative)
Same as beLogged(int,
LogController)
but always checks for a fatal error message, that is a message with
severity
Severity.FATAL. |
boolean |
beFatal(LogController[] relatives)
Same as beLogged(int,
LogController[])
but always checks for a fatal error message, that is a message with
severity
Severity.FATAL. |
boolean |
beGroup()
Checks whether a message with group severity would be written via this log controller. |
boolean |
beInfo()
Same as beLogged(int)
but always checks for an informational message, that is a message with
severity
Severity.INFO. |
boolean |
beInfo(LogController relative)
Same as beLogged(int,
LogController)
but always checks for an informational message, that is a message with
severity
Severity.INFO. |
boolean |
beInfo(LogController[] relatives)
Same as beLogged(int,
LogController[])
but always checks for an informational message, that is a message with
severity
Severity.INFO. |
boolean |
beLogged(int severity)
Checks whether a message with the specified severity would be written via this log controller. |
boolean |
beLogged(int severity,
LogController relative)
Checks whether a message with the specified severity would be written via this log controller with respect to another log controller. |
boolean |
beLogged(int severity,
LogController[] relatives)
Same as beLogged(int,
LogController)
but returns true if one of the specified log controllers yields a positive
result. |
boolean |
bePath()
Same as beLogged(int)
but always checks for a path message, that is a message with severity
Severity.PATH. |
boolean |
bePath(LogController relative)
Same as beLogged(int,
LogController)
but always checks for a path message, that is a message with severity
Severity.PATH. |
boolean |
bePath(LogController[] relatives)
Same as beLogged(int,
LogController[])
but always checks for a path message, that is a message with severity
Severity.PATH. |
boolean |
beWarning()
Same as beLogged(int)
but always checks for a warning message, that is a message with severity
Severity.WARNING. |
boolean |
beWarning(LogController relative)
Same as beLogged(int,
LogController)
but always checks for a warning message, that is a message with severity
Severity.WARNING. |
boolean |
beWarning(LogController[] relatives)
Same as beLogged(int,
LogController[])
but always checks for a warning message, that is a message with severity
Severity.WARNING. |
void |
closeGroup()
Closes the innermost message group of this controller. |
java.util.Collection |
getAllLogs()
Gets all logs (public, private, local and logs inherent from parent) this log controller writes messages to. |
java.util.Collection |
getChildren()
Gets the collection of children of this log controller. |
java.lang.ClassLoader |
getClassLoader()
Gets the class loader assigned to this log controller for getting resource bundles. |
java.lang.String |
getDescription()
Gets the description for this log. |
int |
getEffectiveSeverity()
Gets the current effective severity of this log controller. |
int |
getEffectiveSeverity(LogController relative)
Gets the current effective severity of this log controller with respect to another log controller. |
int |
getEffectiveSeverity(LogController[] relatives)
Same as getEffectiveSeverity(LogController) but returns the
minimum of the values of the specified log controllers. |
java.util.Collection |
getFilters()
Gets the filters that, besides the effective severity, control output via this log controller. |
int |
getGroupSize()
Return max open group size. |
java.util.Collection |
getLocalLogs()
Gets the local logs this log controller writes messages to. |
int |
getLoggedCnt()
|
int |
getLoggedCount()
|
java.util.Collection |
getLogs()
Gets the normal logs this log controller writes messages to. |
int |
getMaximumSeverity()
Gets the current maximum severity of this log controller. |
int |
getMaximumSeverity(LogController relative)
Gets the current maximum severity of this log controller with respect to another log controller. |
int |
getMaximumSeverity(LogController[] relatives)
Same as getMaximumSeverity(LogController) but returns the minimum
of the values of the specified log controllers. |
int |
getMinimumSeverity()
Gets the current minimum severity of this log controller. |
int |
getMinimumSeverity(LogController relative)
Gets the current minimum severity of this log controller with respect to another log controller. |
int |
getMinimumSeverity(LogController[] relatives)
Same as getMinimumSeverity(LogController) but returns the minimum
of the values of the specified log controllers. |
java.lang.String |
getName()
Gets the name for this log. |
java.util.Collection |
getPrivateLogs()
Gets the private logs this log controller writes messages to. |
LogRecord |
getRecord()
Gets the last log record written via this log controller. |
LogController[] |
getRelatives()
|
java.lang.String |
getResourceBundleName()
Gets the name of the optional resource bundle assigned to this log controller. |
java.lang.String |
getVerInUse()
Gets the version of API. |
LogRecord |
group(java.lang.Object msgCode)
Logs group message, specified as a resource name, from this controller. |
LogRecord |
group(java.lang.Object msgCode,
java.lang.Object[] args)
Logs message, specified as resource name, with parameters from this controller. |
LogRecord |
group(java.lang.Object msgCode,
java.lang.Object[] args,
java.lang.String msgClear)
Logs message, specified as resource name, with parameters from this controller. |
LogRecord |
group(java.lang.Object msgCode,
java.lang.String msgClear)
Logs group message, specified as a resource name, from this controller. |
LogRecord |
group(java.lang.String subloc,
java.lang.Object msgCode)
Same as group(java.lang.Object)
but appends a string denoting a sublocation to the name of the group
location. |
LogRecord |
group(java.lang.String subloc,
java.lang.Object msgCode,
java.lang.Object[] args)
Same as group(java.lang.Object,
java.lang.Object[])
but appends a string denoting a sublocation to the name of the group
location. |
LogRecord |
group(java.lang.String subloc,
java.lang.Object msgCode,
java.lang.Object[] args,
java.lang.String msgClear)
Same as group(java.lang.Object,
java.lang.Object[],
java.lang.String)
but appends a string denoting a sublocation to the name of the group
location. |
LogRecord |
group(java.lang.String subloc,
java.lang.Object msgCode,
java.lang.String msgClear)
Same as group(java.lang.Object,
java.lang.String)
but appends a string denoting a sublocation to the name of the group
location. |
LogRecord |
groupT(java.lang.String msg)
Logs simple group message from this controller. |
LogRecord |
groupT(java.lang.String msg,
java.lang.Object[] args)
Logs group message with parameters from this controller. |
LogRecord |
groupT(java.lang.String subloc,
java.lang.String msg)
Same as groupT(java.lang.String)
but appends a string denoting a sublocation to the name of the group
location. |
LogRecord |
groupT(java.lang.String subloc,
java.lang.String msg,
java.lang.Object[] args)
Same as groupT(java.lang.String,
java.lang.Object[])
but appends a string denoting a sublocation to the name of the group
location. |
boolean |
isActivityTracking()
|
boolean |
isFiltersAgreeing(LogRecord rec)
Checks whether all filters associated with this log controller agree with writing a log record. |
void |
release()
Drops all internal references to this log controller and its children. |
void |
removeFilter(Filter filter)
Removes a filter, so that it no longer controls output via this log controller. |
void |
removeFilters()
Removes all filters associated with this log controller. |
void |
removeLog(Log log)
Removes a log associated with this log controller. |
void |
removeLogs()
Removes all logs associated with this log controller. |
void |
reset()
Reset this LogController to the initail state. |
void |
resetAll()
Reset this LogController and his children to the initail state |
void |
resetLoggedCount()
|
static void |
setActivityTracking(ISATChecker value)
|
void |
setClassLoader()
Resets the class loader assigned to this log controller for getting resource bundles. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Assigns a class loader to this log controller for getting resource bundles. |
void |
setDescription(java.lang.String value)
Sets a description for this log. |
void |
setEffectiveSeverity()
Resets the effective severity of this log controller. |
void |
setEffectiveSeverity(int severity)
Sets the effective severity of this log controller. |
void |
setGroupSize(int size)
Set the max group size which indicate how many nested group can be opened on this LogController. |
void |
setMaximumSeverity()
Resets the maximum severity of this log controller. |
void |
setMaximumSeverity(int severity)
Sets the maximum severity of this log controller. |
void |
setMinimumSeverity()
Resets the minimum severity of this log controller. |
void |
setMinimumSeverity(int severity)
Sets the minimum severity of this log controller. |
void |
setName(java.lang.String name)
Sets a name for this log. |
void |
setResourceBundleName()
Resets the resource bundle name of this log controller. |
void |
setResourceBundleName(java.lang.String resourceBundleName)
Assigns a resource bundle name to this log controller. |
| Methods inherited from class com.sap.tc.logging.ExceptionHandling |
getException, getExceptions, handleException, handleException, resetException, throwException |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public void release()
public void reset()
public void resetAll()
public java.lang.String getName()
getName in interface IObjectInfopublic void setName(java.lang.String name)
public java.lang.String getDescription()
getDescription in interface IObjectInfopublic void setDescription(java.lang.String value)
public java.lang.String getVerInUse()
getVerInUse in interface IObjectInfopublic java.util.Collection getChildren()
public void closeGroup()
Location.openGroup(...),
Category.openGroup(...),
ExceptionHandling.getException(),
ExceptionHandling.throwException()public int getGroupSize()
setGroupSize(int)public void setGroupSize(int size)
public LogRecord groupT(java.lang.String msg)
msg - Message text
public LogRecord groupT(java.lang.String subloc,
java.lang.String msg)
groupT(java.lang.String)
but appends a string denoting a sublocation to the name of the group
location.subloc - Name of sublocationmsg - Message text
public LogRecord groupT(java.lang.String msg,
java.lang.Object[] args)
toString.msg - Message templateargs - Arguments as object references
public LogRecord groupT(java.lang.String subloc,
java.lang.String msg,
java.lang.Object[] args)
groupT(java.lang.String,
java.lang.Object[])
but appends a string denoting a sublocation to the name of the group
location.subloc - Name of sublocationmsg - Message textargs - Arguments as object referencespublic LogRecord group(java.lang.Object msgCode)
msgCode - Resource name of messagesetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.String subloc,
java.lang.Object msgCode)
group(java.lang.Object)
but appends a string denoting a sublocation to the name of the group
location.subloc - Name of sublocationmsgCode - Resource name of messagesetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.Object msgCode,
java.lang.Object[] args)
toString. This method also stores a clear text version of the
message, taken from the resource bundle for language code en and
country code US, which is displayed whenever a log viewer cannot
resolve a message code.msgCode - Resource name of message templateargs - Arguments as object referencessetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.String subloc,
java.lang.Object msgCode,
java.lang.Object[] args)
group(java.lang.Object,
java.lang.Object[])
but appends a string denoting a sublocation to the name of the group
location.subloc - Name of sublocationmsgCode - Resource name of messageargs - Arguments as object referencessetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.Object msgCode,
java.lang.String msgClear)
msgCode - Resource name of messagemsgClear - Clear text version of messagesetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.String subloc,
java.lang.Object msgCode,
java.lang.String msgClear)
group(java.lang.Object,
java.lang.String)
but appends a string denoting a sublocation to the name of the group
location.subloc - Name of sublocationmsgCode - Resource name of messagemsgClear - Clear text version of messagesetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.Object msgCode,
java.lang.Object[] args,
java.lang.String msgClear)
toString. This method also stores a clear text version of the
message which is displayed whenever a log viewer cannot resolve a message
code.msgCode - Resource name of message templateargs - Arguments as object referencesmsgClear - Clear text version of messagesetResourceBundleName(java.lang.String)
public LogRecord group(java.lang.String subloc,
java.lang.Object msgCode,
java.lang.Object[] args,
java.lang.String msgClear)
group(java.lang.Object,
java.lang.Object[],
java.lang.String)
but appends a string denoting a sublocation to the name of the group
location.subloc - Name of sublocationmsgCode - Resource name of messageargs - Arguments as object referencesmsgClear - Clear text version of messagesetResourceBundleName(java.lang.String)public LogRecord getRecord()
public int getMinimumSeverity()
Severity.ALL.public int getMinimumSeverity(LogController relative)
relative - Related log controllerSeverity.ALL.public int getMinimumSeverity(LogController[] relatives)
getMinimumSeverity(LogController) but returns the minimum
of the values of the specified log controllers. This is the value that is
effective for a message directed to all of them at the same time, for
example a message belonging to several categories.relatives - Related log controllersSeverity.ALL.public int getEffectiveSeverity()
Severity.NONE.public int getEffectiveSeverity(LogController relative)
relative - Related log controllerSeverity.NONE.public int getEffectiveSeverity(LogController[] relatives)
getEffectiveSeverity(LogController) but returns the
minimum of the values of the specified log controllers. This is the value
that is effective for a message directed to all of them at the same time,
for example a message belonging to several categories.relatives - Related log controllersSeverity.NONE.public int getMaximumSeverity()
Severity.NONE.public int getMaximumSeverity(LogController relative)
relative - Related log controllerSeverity.NONE.public int getMaximumSeverity(LogController[] relatives)
getMaximumSeverity(LogController) but returns the minimum
of the values of the specified log controllers. This is the value that is
effective for a message directed to all of them at the same time, for
example a message belonging to several categories.relatives - Related log controllersSeverity.NONE.public void setMinimumSeverity(int severity)
setEffectiveSeverity(int).severity - New minimum severitypublic void setMinimumSeverity()
setMinimumSeverity(int) with
Severity.ALL.public void setEffectiveSeverity(int severity)
setMinimumSeverity(int) and
setMaximumSeverity(int).severity - New effective severitypublic void setEffectiveSeverity()
setMinimumSeverity() and
setMaximumSeverity().public void setMaximumSeverity(int severity)
setEffectiveSeverity(int).severity - New maximum severitypublic void setMaximumSeverity()
setMinimumSeverity(int) with
Severity.NONE.public java.util.Collection getLogs()
public java.util.Collection getLocalLogs()
public java.util.Collection getPrivateLogs()
public java.util.Collection getAllLogs()
public void addLog(Log log)
log - New log objectpublic void addLocalLog(Log log)
log - New log objectpublic void addPrivateLog(Log log)
log - New log objectpublic void removeLog(Log log)
log - Log to be removedpublic void removeLogs()
public boolean isFiltersAgreeing(LogRecord rec)
rec - Log record to be checkedpublic java.util.Collection getFilters()
public void addFilter(Filter filter)
filter - New filterpublic void removeFilter(Filter filter)
filter - Filter to be removedpublic void removeFilters()
public LogController[] getRelatives()
public java.lang.String getResourceBundleName()
nullsetResourceBundleName(java.lang.String)public void setResourceBundleName(java.lang.String resourceBundleName)
resourceBundle - Name of resource bundlegetResourceBundleName()public void setResourceBundleName()
getResourceBundleName()public java.lang.ClassLoader getClassLoader()
setClassLoader(java.lang.ClassLoader)public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader - Class loadergetClassLoader()public void setClassLoader()
getClassLoader()public boolean beLogged(int severity)
false the message is not going to be written
but not vice versa. To this end, the method checks whether the specified
severity is equal to or higher than the effective severity of the
controller. It does neither take into account severities assigned to
relations with other log controllers nor filters associated with the log
controller or logs. This version of the method is more efficient than the
version also taking another log controller as argument, and therefore
better fits the purpose to avoid inefficiencies.severity - Severity of message to be writtenbeLogged(int,
LogController),
beLogged(int,
LogController[])
public boolean beLogged(int severity,
LogController relative)
false the message is not going to be written
but not vice versa. To this end, the method checks whether the specified
severity is equal to or higher than the effective severity of the
controller or a severity assigned to the relation of this controller to
the one handed over as argument. It does not take into account filters
associated with the log controller or logs. This version of the method is
less efficient than the version with one argument, and therefore does not
fit the purpose to avoid inefficiencies as well.severity - Severity of message to be writtenrelative - Related log controllerbeLogged(int)
public boolean beLogged(int severity,
LogController[] relatives)
beLogged(int,
LogController)
but returns true if one of the specified log controllers yields a positive
result.severity - Severity of message to be writtenrelatives - Related log controllersbeLogged(int)public boolean beDebug()
beLogged(int)
but always checks for a debug message, that is a message with severity
Severity.DEBUG.public boolean beDebug(LogController relative)
beLogged(int,
LogController)
but always checks for a debug message, that is a message with severity
Severity.DEBUG.relative - Log controller that is related to this onepublic boolean beDebug(LogController[] relatives)
beLogged(int,
LogController[])
but always checks for a debug message, that is a message with severity
Severity.DEBUG.relatives - Log controllers that are related to this onepublic boolean bePath()
beLogged(int)
but always checks for a path message, that is a message with severity
Severity.PATH.public boolean bePath(LogController relative)
beLogged(int,
LogController)
but always checks for a path message, that is a message with severity
Severity.PATH.relative - Log controller that is related to this onepublic boolean bePath(LogController[] relatives)
beLogged(int,
LogController[])
but always checks for a path message, that is a message with severity
Severity.PATH.relatives - Log controllers that are related to this onepublic boolean beInfo()
beLogged(int)
but always checks for an informational message, that is a message with
severity
Severity.INFO.public boolean beInfo(LogController relative)
beLogged(int,
LogController)
but always checks for an informational message, that is a message with
severity
Severity.INFO.relative - Log controller that is related to this onepublic boolean beInfo(LogController[] relatives)
beLogged(int,
LogController[])
but always checks for an informational message, that is a message with
severity
Severity.INFO.relatives - Log controllers that are related to this onepublic boolean beWarning()
beLogged(int)
but always checks for a warning message, that is a message with severity
Severity.WARNING.public boolean beWarning(LogController relative)
beLogged(int,
LogController)
but always checks for a warning message, that is a message with severity
Severity.WARNING.relative - Log controller that is related to this onepublic boolean beWarning(LogController[] relatives)
beLogged(int,
LogController[])
but always checks for a warning message, that is a message with severity
Severity.WARNING.relatives - Log controllers that are related to this onepublic boolean beError()
beLogged(int)
but always checks for an error message, that is a message with severity
Severity.ERROR.public boolean beError(LogController relative)
beLogged(int,
LogController)
but always checks for an error message, that is a message with severity
Severity.ERROR.relative - Log controller that is related to this onepublic boolean beError(LogController[] relatives)
beLogged(int,
LogController[])
but always checks for an error message, that is a message with severity
Severity.ERROR.relatives - Log controllers that are related to this onepublic boolean beFatal()
beLogged(int)
but always checks for a fatal error message, that is a message with
severity
Severity.FATAL.public boolean beFatal(LogController relative)
beLogged(int,
LogController)
but always checks for a fatal error message, that is a message with
severity
Severity.FATAL.relative - Log controller that is related to this onepublic boolean beFatal(LogController[] relatives)
beLogged(int,
LogController[])
but always checks for a fatal error message, that is a message with
severity
Severity.FATAL.relatives - Log controllers that are related to this onepublic boolean beGroup()
beLogged(int)public boolean isActivityTracking()
public static void setActivityTracking(ISATChecker value)
public int getLoggedCount()
public void resetLoggedCount()
public int getLoggedCnt()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||