org.apache.oozie.util
Class XLogFilter

java.lang.Object
  extended by org.apache.oozie.util.XLogFilter

public class XLogFilter
extends Object

Filter that will construct the regular expression that will be used to filter the log statement. And also checks if the given log message go through the filter. Filters that can be used are logLevel(Multi values separated by "|") jobId appName actionId token


Field Summary
static String ALLOW_ALL_REGEX
           
static String MAX_ACTIONLIST_SCAN_DURATION
           
static String MAX_SCAN_DURATION
           
 
Constructor Summary
XLogFilter()
           
XLogFilter(XLogUserFilterParam userLogFilter)
           
 
Method Summary
 Date adjustOffset(Date date, int offset)
          Adjust offset, offset will always be in min.
 void calculateAndValidateDateRange(Date jobStartTime, Date jobEndTime)
          Calculate and validate date range.
 void constructPattern()
          Constructs the regular expression according to the filter and assigns it to fileterPattarn.
static void defineParameter(String filterParam)
           
 String getDebugMessage()
           
 Date getEndDate()
           
 Map<String,String> getFilterParams()
           
 String getFormattedEndDate()
           
 String getFormattedStartDate()
           
 int getLogLimit()
           
static Pattern getSplitterPattern()
           
 Date getStartDate()
           
 XLogUserFilterParam getUserLogFilter()
           
 boolean isActionList()
           
 boolean isDebugMode()
           
 boolean isFilterPresent()
           
 boolean matches(ArrayList<String> logParts)
          Checks if the logLevel and logMessage goes through the logFilter.
static void reset()
           
 void setActionList(boolean isActionList)
           
 void setLogLevel(String logLevel)
           
 void setParameter(String filterParam, String value)
           
 void setUserLogFilter(XLogUserFilterParam userLogFilter)
           
 ArrayList<String> splitLogMessage(String logLine)
          Splits the log line into timestamp, logLevel and remaining log message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ACTIONLIST_SCAN_DURATION

public static String MAX_ACTIONLIST_SCAN_DURATION

MAX_SCAN_DURATION

public static String MAX_SCAN_DURATION

ALLOW_ALL_REGEX

public static final String ALLOW_ALL_REGEX
See Also:
Constant Field Values
Constructor Detail

XLogFilter

public XLogFilter()

XLogFilter

public XLogFilter(XLogUserFilterParam userLogFilter)
Method Detail

setLogLevel

public void setLogLevel(String logLevel)

setParameter

public void setParameter(String filterParam,
                         String value)

defineParameter

public static void defineParameter(String filterParam)

isFilterPresent

public boolean isFilterPresent()

matches

public boolean matches(ArrayList<String> logParts)
Checks if the logLevel and logMessage goes through the logFilter.

Parameters:
logParts -
Returns:

splitLogMessage

public ArrayList<String> splitLogMessage(String logLine)
Splits the log line into timestamp, logLevel and remaining log message. Returns array containing timestamp, logLevel, and logMessage if the pattern matches i.e A new log statement, else returns null.

Parameters:
logLine -
Returns:
Array containing log level and log message

constructPattern

public void constructPattern()
Constructs the regular expression according to the filter and assigns it to fileterPattarn. ".*" will be assigned if no filters are set.


reset

public static void reset()

getFilterParams

public final Map<String,String> getFilterParams()

getUserLogFilter

public XLogUserFilterParam getUserLogFilter()

setUserLogFilter

public void setUserLogFilter(XLogUserFilterParam userLogFilter)

getEndDate

public Date getEndDate()

getFormattedEndDate

public String getFormattedEndDate()

getFormattedStartDate

public String getFormattedStartDate()

getStartDate

public Date getStartDate()

isDebugMode

public boolean isDebugMode()

getLogLimit

public int getLogLimit()

getDebugMessage

public String getDebugMessage()

isActionList

public boolean isActionList()

setActionList

public void setActionList(boolean isActionList)

getSplitterPattern

public static Pattern getSplitterPattern()

calculateAndValidateDateRange

public void calculateAndValidateDateRange(Date jobStartTime,
                                          Date jobEndTime)
                                   throws IOException
Calculate and validate date range.

Parameters:
jobStartTime - the job start time
jobEndTime - the job end time
Throws:
IOException - Signals that an I/O exception has occurred.

adjustOffset

public Date adjustOffset(Date date,
                         int offset)
                  throws IOException
Adjust offset, offset will always be in min.

Parameters:
date - the date
offset - the offset
Returns:
the date
Throws:
IOException - Signals that an I/O exception has occurred.


Copyright © 2015 Apache Software Foundation. All Rights Reserved.