Package org.apache.log4j

Examples of org.apache.log4j.Level


     * specified as {@link XLevel#TRACE}.
     */
    public void testToLevel() {
        assertSame("XLevel.TRACE is returned if null name is passed", XLevel.toLevel(null), XLevel.TRACE);
        assertSame("XLevel.TRACE is returned if the name is equal to \"TRACE\" irrespective of case", XLevel.toLevel("trAce"), XLevel.TRACE);
        Level levelResults = Level.toLevel("MOCK", XLevel.TRACE);
        Level xLevelResults = XLevel.toLevel("MOCK");
        assertSame("In all other cases conversion is deferred to Level", xLevelResults, levelResults);
        assertSame("If conversion fails XLevel.TRACE is returned", xLevelResults, XLevel.TRACE);
    }
View Full Code Here


     * Tests that in other cases the conversion is deferred to {@link Level#toLevel(int)}
     * Tests that if conversion fails the {@link Level#DEBUG} is returned.
     */
    public void testToLevelInt() {
        assertSame("XLevel.TRACE is returned is " + TRACE_INT + "is passed", XLevel.toLevel(TRACE_INT), XLevel.TRACE);
        Level levelResults = Level.toLevel(MOCK_INT);
        Level xLevelResults = XLevel.toLevel(MOCK_INT);
        assertSame("In all other cases conversion is deferred to Level", xLevelResults, levelResults);
        assertSame("If conversion fails Level.DEBUG is returned", xLevelResults, Level.DEBUG);
    }
View Full Code Here

        return liveEps;
    }

    public void setLog4jLevel(String classQualifier, String rawLevel)
    {
        Level level = Level.toLevel(rawLevel);
        org.apache.log4j.Logger.getLogger(classQualifier).setLevel(level);
        logger_.info("set log level to " + level + " for classes under '" + classQualifier + "' (if the level doesn't look like '" + rawLevel + "' then log4j couldn't parse '" + rawLevel + "')");
    }
View Full Code Here

        return liveEps;
    }

    public void setLog4jLevel(String classQualifier, String rawLevel)
    {
        Level level = Level.toLevel(rawLevel);
        org.apache.log4j.Logger.getLogger(classQualifier).setLevel(level);
        logger.info("set log level to " + level + " for classes under '" + classQualifier + "' (if the level doesn't look like '" + rawLevel + "' then log4j couldn't parse '" + rawLevel + "')");
    }
View Full Code Here

    private CRS crs = new CRS();

    public Log4jHelper() {}

    public void setDefaultLevel(String level) {
  Level value = null;
  if("all".equalsIgnoreCase(level))
      value = Level.ALL;
  else if("debug".equalsIgnoreCase(level))
      value = Level.DEBUG;
  else if("error".equalsIgnoreCase(level))
View Full Code Here

  crs.setDefaultLevel(value);
    }

    public String getDefaultLevel() {
  String value = null;
  Level level = crs.getDefaultLevel();
  if(level == Level.ALL)
      value = "all";
  else if(level == Level.DEBUG)
      value = "debug";
  else if(level == Level.ERROR)
View Full Code Here

    Collections.sort(
      priorityList,
      new Comparator() {
        public int compare(Object o1, Object o2) {
          Level p1 = (Level) o1;
          Level p2 = (Level) o2;

          if (p1.toInt() == p2.toInt()) {
            return 0;
          } else if (p1.toInt() < p2.toInt()) {
            return -1;
          }

          return 1;
        }
      });

    setModel(
      new DefaultBoundedRangeModel(
        priorityList.indexOf(Level.TRACE), 0, 0, priorityList.size() - 1));

    Hashtable labelMap = new Hashtable();

    for (Iterator iter = priorityList.iterator(); iter.hasNext();) {
      Level item = (Level) iter.next();
      labelMap.put(
        new Integer(priorityList.indexOf(item)), new JLabel(item.toString()));

      //      System.out.println("creating levels for :: " + item.toInt() + "," + item.toString());
    }

    setOrientation(JSlider.VERTICAL);
View Full Code Here

  /**
   * Returns the Log4j Level that is currently selected in this slider
   * @return
   */
  Level getSelectedLevel() {
    Level level = (Level) priorityList.get(getValue());

    if (level == null) {
      level = Level.TRACE;
    }

View Full Code Here

        return liveEps;
    }

    public void setLog4jLevel(String classQualifier, String rawLevel)
    {
        Level level = Level.toLevel(rawLevel);
        org.apache.log4j.Logger.getLogger(classQualifier).setLevel(level);
        logger.info("set log level to " + level + " for classes under '" + classQualifier + "' (if the level doesn't look like '" + rawLevel + "' then log4j couldn't parse '" + rawLevel + "')");
    }
View Full Code Here

     * Tests that if conversion fails the specified default value is returned.
     */
    public void testToLevelWithDefault() {
        assertSame("Default value is indeed returned if null name is passed", XLevel.toLevel(null, MOCK), MOCK);
        assertSame("XLevel.TRACE is returned if the name is equal to \"TRACE\" irrespecctive of case", XLevel.toLevel("trAce"), XLevel.TRACE);
        Level levelResults = Level.toLevel("MOCK", MOCK);
        Level xLevelResults = XLevel.toLevel("MOCK", MOCK);
        assertSame("In all other cases conversion is deferred to Level", xLevelResults, levelResults);
        assertSame("If conversion fails the default value is returned", xLevelResults, MOCK);
    }
View Full Code Here

TOP

Related Classes of org.apache.log4j.Level

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.