|
Log4j 1.3alpha-6 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.log4j.helpers.LoggerTraverse
This helper class can be used to extract/traverse logger information for a given LoggerRepository. It is a work in progress and focus to date has been functionality, not performance or efficiency. The set of loggers can be retrieved in one of two ways: 1) getLoggerNames() - A complete list of the loggers 2) getLoggerPackageNames() - A list of package names, starting at a given package name pattern. If the second retrieval method is used, the caller can iteratively call the LoggerTraverse to retrieve sub-packages and children. This class is dependent on logger names that match Java fully qualified class names. It also provides methods for querying the current level of a given logger and NOTE: This class does not cause any side effects in the LoggerRepository. It does not inadvertantly create new Loggers in the process of parsing the package names or accessing information. NOTE: This class does not automatically keep track of changes in the given LoggerRepository. The caller must call the update() method to get the current set of loggers.
Constructor Summary | |
LoggerTraverse()
Empty constructor. |
|
LoggerTraverse(LoggerRepository repository)
|
Method Summary | |
Level |
getLevelForPackage(java.lang.String packageName)
Returns the effective level for the given package name. |
Level |
getLevelForRootLogger()
Returns the level for the root logger. |
boolean |
getLevelIsSetForPackage(java.lang.String packageName)
Returns true of the package has had its level set directly or false if the level is inherited. |
java.util.List |
getLoggerNames()
Returns the list of all loggers, sorted by name. |
java.util.List |
getLoggerPackageNames(java.lang.String startPattern)
Using a starting name pattern, returns the next level of package names that start with that pattern. |
boolean |
loggerHasSubPackages(java.lang.String startPattern)
Returns true if the given package name appears to have sub-package. |
static void |
main(java.lang.String[] args)
here is an example of using the hierarchical version, iterating through all the package names, all the loggers. |
void |
update(LoggerRepository repository)
Updates the LoggerTraverse to the current information in the given LoggerRepository. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LoggerTraverse()
public LoggerTraverse(LoggerRepository repository)
repository
- The LoggerRepository to traverse.Method Detail |
public void update(LoggerRepository repository)
repository
- LoggerRepository to use for Logger information.public java.util.List getLoggerNames()
public java.util.List getLoggerPackageNames(java.lang.String startPattern)
startPattern
- The name pattern to match for Logger name.
public boolean loggerHasSubPackages(java.lang.String startPattern)
startPattern
- The name pattern to match for Logger name.
public Level getLevelForRootLogger()
public Level getLevelForPackage(java.lang.String packageName)
packageName
- The name of the logger to return the level for.
public boolean getLevelIsSetForPackage(java.lang.String packageName)
packageName
- The name of the logger to return the level for.
public static void main(java.lang.String[] args)
args
- Parameters for main execution.
|
Log4j 1.3alpha-6 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |