Search in sources :

Example 1 with XLogErrorStreamer

use of org.apache.oozie.util.XLogErrorStreamer in project oozie by apache.

the class TestZKXLogStreamingService method doStreamLog.

protected String doStreamLog(XLogFilter xf, Map<String, String[]> param, boolean isErrorLog, Date startTime, Date endTime) throws Exception {
    StringWriter w = new StringWriter();
    ZKXLogStreamingService zkxlss = new ZKXLogStreamingService();
    try {
        Services services = Services.get();
        services.setService(ZKJobsConcurrencyService.class);
        zkxlss.init(services);
        // Sleep to allow ZKUtils ServiceCache to update
        sleep(1000);
        if (isErrorLog) {
            zkxlss.streamLog(new XLogErrorStreamer(xf, param), startTime, endTime, w);
        } else {
            zkxlss.streamLog(new XLogStreamer(xf, param), startTime, endTime, w);
        }
    } finally {
        zkxlss.destroy();
    }
    String wStr = w.toString();
    System.out.println("\ndoStreamLog:\n" + wStr + "\n");
    return wStr;
}
Also used : StringWriter(java.io.StringWriter) XLogErrorStreamer(org.apache.oozie.util.XLogErrorStreamer) XLogStreamer(org.apache.oozie.util.XLogStreamer)

Aggregations

StringWriter (java.io.StringWriter)1 XLogErrorStreamer (org.apache.oozie.util.XLogErrorStreamer)1 XLogStreamer (org.apache.oozie.util.XLogStreamer)1