Package org.objectweb.util.monolog.api

Examples of org.objectweb.util.monolog.api.Level


    }

    // Check the monolog objects
    //==========================
    //------ Level ------//
    Level le = null;
    le = lef.getLevel("LOAD_DEBUG1");
    assertNotNull("level: LOAD_DEBUG1: undefined", le);
    assertEquals("level: LOAD_DEBUG1: bad int value",
      BasicLevel.DEBUG + 1,le.getIntValue());
    assertEquals("level: LOAD_DEBUG1: bad string expr",
      "DEBUG + 1", ((LevelImpl) le).getStringValue());

    le = lef.getLevel("LOAD_DEBUG2");
    assertNotNull("level: LOAD_DEBUG2: undefined", le);
    assertEquals("level: LOAD_DEBUG2: bad int value",
      BasicLevel.DEBUG + 2,le.getIntValue());
    assertEquals("level: LOAD_DEBUG2: bad string expr",
      String.valueOf(BasicLevel.DEBUG + 2),
      ((LevelImpl) le).getStringValue());

    //------ Handler ------//
View Full Code Here


        return mf.getLevels();
    }

    public int compareTo(String levelname1, String levelname2)
            throws RemoteException {
        Level l1 = mf.getLevel(levelname1);
        if (l1 == null) {
            return Integer.MAX_VALUE;
        }
        Level l2 = mf.getLevel(levelname2);
        if (l1 == null) {
            return Integer.MIN_VALUE;
        }
        return l1.compareTo(l2);
    }
View Full Code Here

      l.setIntLevel(level);
  }

  public void setLoggerLevel(String levelName, String loggerName) throws RemoteException {
        TopicalLogger l = (TopicalLogger) mf.getLogger(loggerName);
        Level level = mf.getLevel(levelName);
        if (level != null) {
            l.setLevel(level);
        }
  }
View Full Code Here

        return mf.getLevels();
    }

    public int compareTo(String levelname1, String levelname2)
             {
        Level l1 = mf.getLevel(levelname1);
        if (l1 == null) {
            return Integer.MAX_VALUE;
        }
        Level l2 = mf.getLevel(levelname2);
        if (l2 == null) {
            return Integer.MIN_VALUE;
        }
        return l1.compareTo(l2);
    }
View Full Code Here

   * @param level is the level to assign the logger
   * @param loggerName is the name of logger which the level must be set.
   */
  public void setLoggerLevel(String levelName, String loggerName) {
        TopicalLogger l = (TopicalLogger) mf.getLogger(loggerName);
        Level level = mf.getLevel(levelName);
        if (level != null) {
            l.setLevel(level);
        }
  }
View Full Code Here

        } catch (NumberFormatException e) {
          continue;
        }
      } else if (Character.isLetter(elem.charAt(0))) {
        // The token is another intermediate level
        Level l = lf.getLevel(elem);
        if (l == null) {
                    l = lf.getLevel(elem.toUpperCase());
                    if (l == null) {
                        return 0;
                    }
        }
        firstOperande = l.getIntValue();
      } else if (elem.charAt(0) == '+') {
        operator = 1;
      } else if (elem.charAt(0) == '-') {
        operator = 2;
      } else if (Character.isSpaceChar(elem.charAt(0))) {
View Full Code Here

                val = "false";
                debug(key + " " + val);
                prop.put(key, val.trim());
            }

            Level level = loggers[i].getCurrentLevel();
            if (level != null && level.getIntValue() != BasicLevel.INHERIT) {
                key = begin + DOT + LEVEL_FIELD;
                val = " " + level.getName();
                debug(key + " " + val);
                prop.put(key, val.trim());
            }

            handlers = loggers[i].getHandler();
View Full Code Here

        if (last.equalsIgnoreCase(LEVEL_FIELD)) {
            // Assigns the level of the logger
            logger = (TopicalLogger)
                    mf.getLogger(DottedStringTools.getBegin(temp));
            String levelName = prop.getProperty(key).trim();
            Level l = mf.getLevel(levelName);
            if (l == null) {
                l = parseLevelProp(prop, LEVEL_FIELD + DOT + levelName, mf);
            }
            if (debug) {
                debug("set level to " + l.getName() + " to the logger " + logger.getName());
            }
            logger.setLevel(l);
        } else if (ADDITIVITY_FIELD.equalsIgnoreCase(last)
                || USE_PARENT_FIELD.equalsIgnoreCase(last)) {
            logger = (TopicalLogger)
View Full Code Here

        String temp = DottedStringTools.getFirst(key);
        if (temp == null || !temp.equalsIgnoreCase(LEVEL_FIELD))
            throw new Exception("This key is not a level field:" + key);

        temp = DottedStringTools.getEnd(key);
        Level l = lef.getLevel(temp);
        if (l == null) {
            if (!prop.containsKey(key)) {
                throw new Exception("Level definition not found: " + key);
            }
            if (currentLevelParse.contains(temp)) {
View Full Code Here

  public Level[] getLevels() {
    return (Level[]) nameToLevel.values().toArray(new Level[0]);
  }

  public void removeLevel(String name) {
    Level removed = (Level) nameToLevel.remove(name);
    if (removed != null) {
      Integer i = new Integer(removed.getIntValue());
      Object temp = intToNames.get(i);
      if (temp instanceof String) {
        intToNames.remove(i);
      }
      else if (temp instanceof ArrayList) {
View Full Code Here

TOP

Related Classes of org.objectweb.util.monolog.api.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.