Package org.apache.log4j

Examples of org.apache.log4j.Priority


  LogLog.debug("Desired Priority sub-class: ["+className+']');
  try {  
    Class clazz = Class.forName(className);
    Method toPriorityMethod = clazz.getMethod("toPriority",
                ONE_STRING_PARAM);
    Priority pri = (Priority) toPriorityMethod.invoke(null,
                new Object[] {priStr});
    cat.setPriority(pri);
  } catch (Exception oops) {
    LogLog.error("Could not create priority ["+priStr+
           "]. Reported error follows.", oops);
View Full Code Here


    if (hashIndex == -1) {
      // no class name specified : use standard Priority class
      return Priority.toPriority(value, defaultValue);
    }

    Priority result = defaultValue;

    String clazz = value.substring(hashIndex+1);
    String priorityName = value.substring(0, hashIndex);

    LogLog.debug("toPriority" + ":class=[" + clazz + "]"
View Full Code Here


  public
  void toPriorityTest1() {
    String val = "INFO";
    Priority p = OptionConverter.toPriority(val, null);
    assertEquals(p, Priority.INFO);
  }
View Full Code Here

  }

  public
  void toPriorityTest2() {
    String val = "INFO#org.apache.log4j.xml.examples.XPriority";
    Priority p = OptionConverter.toPriority(val, null);
    assertEquals(p, Priority.INFO);
  }
View Full Code Here

  }

  public
  void toPriorityTest3() {
    String val = "TRACE#org.apache.log4j.xml.examples.XPriority";
    Priority p = OptionConverter.toPriority(val, null);   
    assertEquals(p, XPriority.TRACE);
  }
View Full Code Here

  }

  public
  void toPriorityTest4() {
    String val = "TR#org.apache.log4j.xml.examples.XPriority";
    Priority p = OptionConverter.toPriority(val, null);   
    assertEquals(p, null);
  }
View Full Code Here

  }

  public
  void toPriorityTest5() {
    String val = "INFO#org.apache.log4j.xml.TOTO";
    Priority p = OptionConverter.toPriority(val, null);   
    assertEquals(p, null);
  }
View Full Code Here

    // Can't perform test if category is not instantiated
    if(localCT == null)
      return true;
   
    // find expected priority
    Priority expected = getExpectedPrioriy(localCT);

         
    Priority purported = cat[i].getChainedPriority();

    if(expected != purported) {
      System.out.println("Expected priority for " + localCT.catstr + " is " +
           expected);
      System.out.println("Purported priority for "+ cat[i].name + " is "+purported);
View Full Code Here

     
  }

  static
  Priority getExpectedPrioriy(CT ctParam) {
    Priority priority = ctParam.priority;
    if(priority != null)
      return priority;

   
    String catstr = ctParam.catstr;   
   
    for(int i = catstr.lastIndexOf('.', catstr.length()-1); i >= 0;
                                i = catstr.lastIndexOf('.', i-1))  {
      String substr = catstr.substring(0, i);

      // find the priority of ct corresponding to substr
      for(int j = 0; j < LENGTH; j++) { 
  if(ct[j] != null && substr.equals(ct[j].catstr)) {
    Priority p = ct[j].priority;
    if(p != null)
      return p;   
  }
      }
    }
View Full Code Here

  LogLog.debug("Desired Priority sub-class: ["+className+']');
  try {  
    Class clazz = Class.forName(className);
    Method toPriorityMethod = clazz.getMethod("toPriority",
                ONE_STRING_PARAM);
    Priority pri = (Priority) toPriorityMethod.invoke(null,
                new Object[] {priStr});
    cat.setPriority(pri);
  } catch (Exception oops) {
    LogLog.error("Could not create priority ["+priStr+
           "]. Reported error follows.", oops);
View Full Code Here

TOP

Related Classes of org.apache.log4j.Priority

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.