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 Abhijat Thakur <at...@bdnacorp.com> on 2002/04/03 02:17:40 UTC

Disabling And Enabling Priority For a Category

Hi,

I am using Log4j version 1.1.2. Have two methods one to disable priority
for a category and the other to enable all priorities for a category. I
am just 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 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.
What am i doing wrong here, since this is not the expected behaviour. 

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>