Examples of XLogStreamer


Examples of org.apache.oozie.util.XLogStreamer

        gzout.close();

        // Test for the log retrieval of the job that began 10 seconds before and ended 5 seconds before current time
        // respectively
        StringWriter sw = new StringWriter();
        XLogStreamer str = new XLogStreamer(xf, sw, getTestCaseDir(), "oozie.log", 1);
        str.streamLog(new Date(currTime - 10000), new Date(currTime - 5000));
        String[] out = sw.toString().split("\n");
        // Check if the retrieved log content is of length seven lines after filtering based on time window, file name
        // pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
        assertEquals(7, out.length);
        // Check if the lines of the log contain the expected strings
        assertEquals(true, out[0].contains("_L10_"));
        assertEquals(true, out[1].contains("_L11_"));
        assertEquals(true, out[2].contains("_L8_"));
        assertEquals(true, out[3].contains("_L9_"));
        assertEquals(true, out[4].contains("_L1_"));
        assertEquals(true, out[5].contains("_L2_"));
        assertEquals(true, out[6].contains("_L4_"));

        // Test to check if the null values for startTime and endTime are translated to 0 and current time respectively
        // and corresponding log content is retrieved properly
        StringWriter sw1 = new StringWriter();
        XLogStreamer str1 = new XLogStreamer(xf, sw1, getTestCaseDir(), "oozie.log", 1);
        str1.streamLog(null, null);
        out = sw1.toString().split("\n");
        // Check if the retrieved log content is of length eight lines after filtering based on time window, file name
        // pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
        assertEquals(8, out.length);
        // Check if the lines of the log contain the expected strings
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

     * @param writer writer to stream the log to.
     * @throws IOException thrown if the log cannot be streamed.
     */
    public void streamLog(XLogStreamer.Filter filter, Date startTime, Date endTime, Writer writer) throws IOException {
        if (logOverWS) {
            new XLogStreamer(filter, writer, oozieLogPath, oozieLogName, oozieLogRotation)
                    .streamLog(startTime, endTime);
        }
        else {
            writer.write("Log streaming disabled!!");
        }
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

        fwerr.close();
        File ferr = new File(getTestCaseDir() + "/testerr.log");
        ferr.setLastModified(currTime - 8000);

        StringWriter sw = new StringWriter();
        XLogStreamer str = new XLogStreamer(xf, sw, getTestCaseDir(), "test.log", 1);
        str.streamLog(new Date(currTime - 10000), new Date(currTime - 5000));
        String[] out = sw.toString().split("\n");
        assertEquals(3, out.length);
        assertEquals(true, out[0].contains("_L1_"));
        assertEquals(true, out[1].contains("_L2_"));
        assertEquals(true, out[2].contains("_L4_"));

        StringWriter sw1 = new StringWriter();
        XLogStreamer str1 = new XLogStreamer(xf, sw1, getTestCaseDir(), "test.log", 1);
        str1.streamLog(null, null);
        out = sw1.toString().split("\n");
        assertEquals(4, out.length);
        assertEquals(true, out[0].contains("_L1_"));
        assertEquals(true, out[1].contains("_L2_"));
        assertEquals(true, out[2].contains("_L4_"));
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

     * @param writer writer to stream the log to.
     * @throws IOException thrown if the log cannot be streamed.
     */
    public void streamLog(XLogStreamer.Filter filter, Date startTime, Date endTime, Writer writer) throws IOException {
        if (logOverWS) {
            new XLogStreamer(filter, writer, oozieLogPath, oozieLogName, oozieLogRotation)
                    .streamLog(startTime, endTime);
        }
        else {
            writer.write("Log streaming disabled!!");
        }
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

     * @param writer writer to stream the log to.
     * @throws IOException thrown if the log cannot be streamed.
     */
    public void streamLog(XLogStreamer.Filter filter, Date startTime, Date endTime, Writer writer) throws IOException {
        if (logOverWS) {
            new XLogStreamer(filter, writer, oozieLogPath, oozieLogName, oozieLogRotation)
                    .streamLog(startTime, endTime);
        }
        else {
            writer.write("Log streaming disabled!!");
        }
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

     * @param writer writer to stream the log to.
     * @throws IOException thrown if the log cannot be streamed.
     */
    public void streamLog(XLogStreamer.Filter filter, Date startTime, Date endTime, Writer writer) throws IOException {
        if (logOverWS) {
            new XLogStreamer(filter, writer, oozieLogPath, oozieLogName, oozieLogRotation)
                    .streamLog(startTime, endTime);
        }
        else {
            writer.write("Log streaming disabled!!");
        }
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

        writeToGZFile(f,sb);

        // Test for the log retrieval of the job that began 10 seconds before and ended 5 seconds before current time
        // respectively
        StringWriter sw = new StringWriter();
        XLogStreamer str = new XLogStreamer(xf, sw, getTestCaseDir(), "oozie.log", 1);
        str.streamLog(new Date(currTime - 10000), new Date(currTime - 5000));
        String[] out = sw.toString().split("\n");
        // Check if the retrieved log content is of length seven lines after filtering based on time window, file name
        // pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
        assertEquals(7, out.length);
        // Check if the lines of the log contain the expected strings
        assertEquals(true, out[0].contains("_L10_"));
        assertEquals(true, out[1].contains("_L11_"));
        assertEquals(true, out[2].contains("_L8_"));
        assertEquals(true, out[3].contains("_L9_"));
        assertEquals(true, out[4].contains("_L1_"));
        assertEquals(true, out[5].contains("_L2_"));
        assertEquals(true, out[6].contains("_L4_"));

        // Test to check if the null values for startTime and endTime are translated to 0 and current time respectively
        // and corresponding log content is retrieved properly
        StringWriter sw1 = new StringWriter();
        XLogStreamer str1 = new XLogStreamer(xf, sw1, getTestCaseDir(), "oozie.log", 1);
        str1.streamLog(null, null);
        out = sw1.toString().split("\n");
        // Check if the retrieved log content is of length eight lines after filtering based on time window, file name
        // pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
        assertEquals(8, out.length);
        // Check if the lines of the log contain the expected strings
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

        File f1 = new File(getTestCaseDir() + "/oozie.log");
        f1.setLastModified(currTime - 5000);

        // Test for the log retrieval of the job spanning multiple hours
        StringWriter sw2 = new StringWriter();
        XLogStreamer str2 = new XLogStreamer(xf, sw2, getTestCaseDir(), "oozie.log", 1);
        Calendar calendarEntry = Calendar.getInstance();
        // Setting start-time to 2012-04-24-19 for log stream (month-1 passed as parameter since 0=January), and end time is current time
        calendarEntry.set(2012, 3, 24, 19, 0);
        str2.streamLog(calendarEntry.getTime(), new Date(System.currentTimeMillis()));
        String[] out = sw2.toString().split("\n");

        // Check if the retrieved log content is of length five lines after filtering based on time window, file name
        // pattern and parameters like JobId, Username etc. and/or based on log level like INFO, DEBUG, etc.
        assertEquals(5, out.length);
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

     */
    public void streamLog(XLogFilter filter, Date startTime, Date endTime, Writer writer, Map<String, String[]> params)
            throws IOException {
        XLogService xLogService = Services.get().get(XLogService.class);
        if (xLogService.getLogOverWS()) {
            new XLogStreamer(filter, xLogService.getOozieLogPath(), xLogService.getOozieLogName(),
                    xLogService.getOozieLogRotation()).streamLog(writer, startTime, endTime, bufferLen);
        }
        else {
            writer.write("Log streaming disabled!!");
        }
View Full Code Here

Examples of org.apache.oozie.util.XLogStreamer

            throws IOException {
        XLogService xLogService = Services.get().get(XLogService.class);
        if (xLogService.getLogOverWS()) {
            // If ALL_SERVERS_PARAM is set to false, then only stream our log
            if (!Services.get().get(JobsConcurrencyService.class).isAllServerRequest(params)) {
                new XLogStreamer(filter, xLogService.getOozieLogPath(), xLogService.getOozieLogName(),
                        xLogService.getOozieLogRotation()).streamLog(writer, startTime, endTime, bufferLen);
            }
            // Otherwise, we have to go collate relevant logs from the other Oozie servers
            else {
                collateLogs(filter, startTime, endTime, writer, params);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.