You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Abhijat Thakur <at...@bdnacorp.com> on 2002/04/03 04:49:17 UTC

Enabling and Disabling Priority For a Category

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. 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 in advance !

Abhijat


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>