in qa/src/main/java/org/apache/brooklyn/qa/longevity/MonitorUtils.java [242:262]
public static List<String> searchLog(File file, String grepOfInterest, Set<String> grepExclusions) {
Process process = exec(String.format("grep -E %s %s", grepOfInterest, file.getAbsoluteFile()));
String out = waitFor(process);
// TODO Annoying that String.split() returns size 1 when empty string; lookup javadoc when back online...
if (out.length() == 0) return Collections.<String>emptyList();
List<String> result = new ArrayList<String>();
for (String line : out.trim().split("\n")) {
boolean excluded = false;
for (String exclusion : grepExclusions) {
if (!isNullOrEmpty(exclusion) && hasAtLeastOneMatch(line, exclusion)) {
excluded = true;
}
}
if (!excluded) {
result.add(line);
}
}
return result;
}