You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Thilo Schottelius <Th...@impress.com> on 2001/05/11 15:37:47 UTC
CategoryManager Example
Hi anybody,
I attached a solution how to handle the need of different
categories/appenders for threads, applications, sessions or what else. The
solution consists of two classes:
1) CategoryManager.java
2) TestCategoryManager.java
1) manages all the categories in a hashtable. The generel procedure is to
"register" your class at the manager:
CategoryManager.setABCCategory("a","b","c");
and then retrieve the Category from the manager:
Category myCat= CategoryManager.getABCCategory("a","b","c");
You can now add file appenders, layouts etc. to myCat during runtime. The
class CategoryManager knows which categories exists at the moment.
2) Is an example of how to use.
Maybe ou have to adapt the code to get it working.
Thilo