com.resilientedge.util.logger
Class TopicLevelFilter
java.lang.Object
|
+--com.resilientedge.util.logger.TopicLevelFilter
- All Implemented Interfaces:
- Filter
- public class TopicLevelFilter
- extends java.lang.Object
- implements Filter
A filter designed to restrict logging based on a level and topic. It uses
the Prefs.getRoot() to obtain a preferences context and lookup lists of
topics for a level that should be denied a log entry. To determine what
topics and levels should not be logged, place an entry in the appropriate
preferences file with the following key:
logger.level.<level>.deny
and a comma-separated list of topics
(case sensitive) to prevent logging. Optionally, the wildcard character '*'
may be used to prevent all topics, unnamed topics ("") from being logged.
Example: # Deny the following topics at the trace level
logger.level.trace.deny=DatasourceFactory, CastorDatasource, CastorLog,
Transport # Deny the following topics at the debug level
logger.level.debug.deny=Transport # Deny all topics at the info level
logger.level.info.deny=
Note, refer to the Level
class
for the string constants that represent a level.
- Version:
- $Revision: 1.1.1.1 $
- Author:
- jwh
Field Summary |
static java.lang.String |
WILDCARD
The character that indicates a wildcard |
Method Summary |
Logger |
getLogger()
This method returns the LevelFilter's logger. |
protected java.lang.String[] |
getTopicsAllowedForLevel(java.lang.String level)
Gets the TopicsAllowedForLevel attribute of the TopicLevelFilter object |
protected java.lang.String[] |
getTopicsDeniedForLevel(java.lang.String level)
Gets the TopicsDeniedForLevel attribute of the TopicLevelFilter object |
boolean |
isLoggable(LogRecord logRecord)
Returns true if the log record should be logged, false if not. |
void |
setLogger(Logger logger)
This method assigns the LevelFilter's logger. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WILDCARD
public static final java.lang.String WILDCARD
- The character that indicates a wildcard
TopicLevelFilter
public TopicLevelFilter()
setLogger
public void setLogger(Logger logger)
- This method assigns the LevelFilter's logger.
- Specified by:
setLogger
in interface Filter
- Parameters:
logger
- The Logger to which this Filter belongs.
isLoggable
public boolean isLoggable(LogRecord logRecord)
- Returns true if the log record should be logged, false if not.
- Specified by:
isLoggable
in interface Filter
- Parameters:
logRecord
- the logRecord used to determine log-ability.- Returns:
- true if logRecord should be logged.
getLogger
public Logger getLogger()
- This method returns the LevelFilter's logger.
- Specified by:
getLogger
in interface Filter
- Returns:
- the LevelFilter's logger.
getTopicsDeniedForLevel
protected java.lang.String[] getTopicsDeniedForLevel(java.lang.String level)
- Gets the TopicsDeniedForLevel attribute of the TopicLevelFilter object
- Parameters:
level
- Parameter Description- Returns:
- The TopicsDeniedForLevel value
getTopicsAllowedForLevel
protected java.lang.String[] getTopicsAllowedForLevel(java.lang.String level)
- Gets the TopicsAllowedForLevel attribute of the TopicLevelFilter object
- Parameters:
level
- Parameter Description- Returns:
- The TopicsAllowedForLevel value
Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.