Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Logback: the reliable, generic, fast and flexible logging framework. Copyright (C) 1999-2011, QOS.ch. All rights reserved. This program and the accompanying materials are dual-licensed under either the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation or (per the licensee's choosing) under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.
 
 package ch.qos.logback.core.status;
 
 import java.util.List;
 
 
 import static ch.qos.logback.core.status.StatusUtil.filterStatusListByTimeThreshold;
 
 public class StatusChecker {
 
 
   public StatusChecker(StatusManager sm) {
     this. = sm;
   }
 
   public StatusChecker(Context context) {
     this. = context.getStatusManager();
   }
 
   public boolean hasXMLParsingErrors(long threshold) {
     return containsMatch(threshold..);
   }
 
   public boolean noXMLParsingErrorsOccurred(long threshold) {
     return !hasXMLParsingErrors(threshold);
   }
 
   public int getHighestLevel(long threshold) {
     List<StatusfilteredList = filterStatusListByTimeThreshold(.getCopyOfStatusList(), threshold);
     int maxLevel = .;
     for (Status s : filteredList) {
       if (s.getLevel() > maxLevel)
         maxLevel = s.getLevel();
     }
     return maxLevel;
   }
 
   public boolean isErrorFree(long threshold) {
     return . > getHighestLevel(threshold);
   }
 
   public boolean containsMatch(long thresholdint levelString regex) {
     List<StatusfilteredList = filterStatusListByTimeThreshold(.getCopyOfStatusList(), threshold);
     Pattern p = Pattern.compile(regex);
 
     for (Status status : filteredList) {
       if (level != status.getLevel()) {
         continue;
       }
       String msg = status.getMessage();
       Matcher matcher = p.matcher(msg);
       if (matcher.lookingAt()) {
         return true;
       }
     }
     return false;
 
   }
 
   public boolean containsMatch(int levelString regex) {
     return containsMatch(0, levelregex);
   }
 
   public boolean containsMatch(String regex) {
     Pattern p = Pattern.compile(regex);
     for (Status status : .getCopyOfStatusList()) {
       String msg = status.getMessage();
       Matcher matcher = p.matcher(msg);
       if (matcher.lookingAt()) {
         return true;
       }
     }
     return false;
   }
 
   public int matchCount(String regex) {
     int count = 0;
     Pattern p = Pattern.compile(regex);
     for (Status status : .getCopyOfStatusList()) {
       String msg = status.getMessage();
       Matcher matcher = p.matcher(msg);
      if (matcher.lookingAt()) {
        count++;
      }
    }
    return count;
  }
  public boolean containsException(Class exceptionType) {
    Iterator stati = .getCopyOfStatusList().iterator();
    while (stati.hasNext()) {
      Status status = (Statusstati.next();
      Throwable t = status.getThrowable();
      if (t != null && t.getClass().getName().equals(exceptionType.getName())) {
        return true;
      }
    }
    return false;
  }

  
Return the time of last reset. -1 if last reset time could not be found

Returns:
time of last reset or -1
  public long timeOfLastReset() {
    List<StatusstatusList = .getCopyOfStatusList();
    if(statusList == null)
      return -1;
    int len = statusList.size();
    for(int i = len-1; i >= 0; i--) {
      Status s = statusList.get(i);
        return s.getDate();
      }
    }
    return -1;
  }
New to GrepCode? Check out our FAQ X