code: public Level getEffectiveLevel() {
          for (Category c = this; c != null; c = c.parent) {
              if (c.level != null)
                  return c.level;
          }
          return null; // If reached will cause an NullPointerException.
      }
docs: Starting from this category, search the category hierarchy for a non-null level and return it. Otherwise, return the level of the
  root category.
  
  <p>
  The Category class is designed so that this method executes as quickly as possible.