use of org.apache.oozie.util.XLogFilter in project oozie by apache.
the class TestXLogUserFilterParam method testloglevel_Error.
public void testloglevel_Error() throws Exception {
setLogFile();
String logLevel = XLogUserFilterParam.LOG_LEVEL + "=ERROR";
Map<String, String[]> paramMap = new HashMap<String, String[]>();
paramMap.put(RestConstants.LOG_FILTER_OPTION, new String[] { logLevel });
XLogFilter xf = new XLogFilter(new XLogUserFilterParam(paramMap));
String out = doStreamLog(xf);
int count = 0;
for (String line : out.split(System.getProperty("line.separator"))) {
assertFalse(line.contains("DEBUG"));
assertFalse(line.contains("INFO"));
count++;
}
assertEquals(count, 20);
}
use of org.apache.oozie.util.XLogFilter in project oozie by apache.
the class TestXLogUserFilterParam method testTextSearch.
// Test text search
public void testTextSearch() throws Exception {
setLogFile();
XLogFilter filter = new XLogFilter();
String param = XLogUserFilterParam.SEARCH_TEXT + "=substitution;" + XLogUserFilterParam.LIMIT + "=2";
Map<String, String[]> paramMap = new HashMap<String, String[]>();
paramMap.put(RestConstants.LOG_FILTER_OPTION, new String[] { param });
XLogUserFilterParam logUtil = new XLogUserFilterParam(paramMap);
filter.setUserLogFilter(logUtil);
String out = doStreamLog(filter);
String[] lines = out.split(System.getProperty("line.separator"));
assertEquals(lines.length, 2);
assertTrue(lines[0].contains("E0803: IO error, Variable substitution depth too large: 20 ${dniInputDir}"));
assertTrue(lines[1].contains("E0803: IO error, Variable substitution depth too large: 20 ${dniInputDir}"));
}
use of org.apache.oozie.util.XLogFilter in project oozie by apache.
the class TestXLogUserFilterParam method testloglevel_DEBUF_INFO.
// Test multiple log level
public void testloglevel_DEBUF_INFO() throws Exception {
setLogFile();
String logLevel = XLogUserFilterParam.LOG_LEVEL + "=DEBUG|INFO";
Map<String, String[]> paramMap = new HashMap<String, String[]>();
paramMap.put(RestConstants.LOG_FILTER_OPTION, new String[] { logLevel });
XLogFilter xf = new XLogFilter(new XLogUserFilterParam(paramMap));
String out = doStreamLog(xf);
String[] lines = out.split(System.getProperty("line.separator"));
assertEquals(lines.length, 4);
assertTrue(lines[1].startsWith("2014-02-27 02:06:49,215 DEBUG CoordActionStartXCommand:545 [pool-2-thread-236] - USER[-] GROUP[-] " + "TOKEN[-] APP[-]"));
assertTrue(lines[2].startsWith("2014-02-27 02:06:49,215 DEBUG CoordActionStartXCommand:545 [pool-2-thread-236] - USER[-] GROUP[-] " + "TOKEN[-] APP[-] JOB[0601839-140127221758655-oozie-wrkf-C]"));
assertTrue(lines[3].startsWith("2014-02-27 02:06:49,215 INFO CoordActionStartXCommand:545 [pool-2-thread-236] - USER[-] GROUP[-] " + "TOKEN[-] APP[-] JOB[0601839-140127221758655-oozie-wrkf-C]"));
}
Aggregations