logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhijat Thakur" <atha...@bdnacorp.com>
Subject enabling and disabling priority at run time
Date Thu, 04 Apr 2002 20:22:58 GMT
Hi,

I am using Log4j version 1.1.3. Have two methods one to disable priority
for a category and the other to enable all priorities for a category at
run time. I
am only enclosing the relevant portion of the methods. I have two
category COM.BDNA.PL and COM.BDNA.AGENDA.

What happens is that when for COM.BDNA.AGENDA i disable a priority it
disables that priority for COM.BDNA.PL too. And same is the case that
for method enableAll and that is if i have disabled the priority for
COM.BDNA.AGENDA and i call enableAll for category COM.BDNA.PL it enables
all disabled priorities for COM.BDNA.AGENDA. I could understand if these
two categories were in the same Hierarchy but they are in two different
hierarchies. The parents are same but they are two different children. 

In fact after doing a couple of tests i found that if i create a
Category test.foo and disable some priority, then that disables that
priority of all other remainder Categories too like COM.BDNA.Pl,
COM.BDNA.AGENDA.

What am i doing wrong here, since this is not the expected behaviour. 

	/**
	 * Method to disable a priority associated with a Category
	 */
	public static void disablePriority(String categoryName,
                                   String priorityName){
        Category cat = Category.exists(categoryName);
        Priority priority = checkPriority(priorityName); // checking if
priority is valid
        cat.getHierarchy().disable(priority);
	}

    /**
     * Method to undo the affect of disabling a priority in a particular
	Hierarchy
     * @param categoryName The name of the category
     * @return void
     * @exception BDNAException
     */
    public static void enableAll(String categoryName) throws
	BDNAException {

        ArrayList arg = null;
        String errMsg = checkForNull(categoryName, "Category Name, ");
        if(errMsg.length() > 0) {
            errMsg = errMsg.substring(0, errMsg.length() - 2);
            arg = new ArrayList();
            arg.add(errMsg);
            throw new BDNAException("com.bdna.pl.rs_empty_err", arg);
        }
        Category cat = Category.exists(categoryName);
        if (cat == null) {
            arg = new ArrayList();
            arg.add(categoryName);
            throw new BDNAException("com.bdna.pl.rs_category_err", arg);
        }
        cat.getHierarchy().enableAll();
    }


Thanks.

Abhijat

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message