Class LogFilter


  • @Service
    public class LogFilter
    extends Object

    LogFilter will be used by Admin Too Log Viewer Front End to filter the records. LogMBean delegates the getLogRecordsUsingQuery method to this class static method.

    • Constructor Detail

      • LogFilter

        public LogFilter()
    • Method Detail

      • getLogRecordsUsingQuery

        public AttributeList getLogRecordsUsingQuery​(String logFileName,
                                                     Long fromRecord,
                                                     Boolean next,
                                                     Boolean forward,
                                                     Integer requestedCount,
                                                     Date fromDate,
                                                     Date toDate,
                                                     String logLevel,
                                                     Boolean onlyLevel,
                                                     List listOfModules,
                                                     Properties nameValueMap,
                                                     String anySearch)
        The public method that Log Viewer Front End will be calling on. The query will be run on records starting from the fromRecord. If any of the elements for the query is null, then that element will not be used for the query. If the user is interested in viewing only records whose Log Level is SEVERE and WARNING, then the query would look like:

        fromDate = null, toDate = null, logLevel = WARNING, onlyLevel = false, listOfModules = null, nameValueMap = null.

        Parameters:
        logFileName - The LogFile to use to run the query. If null the current server.log will be used. This is not the absolute file name, just the fileName needs to be passed. We will use the parent directory of the previous server.log to build the absolute file name.
        fromRecord - The location within the LogFile
        next - True to get the next set of results, false to get the previous set
        forward - True to search forward through the log file
        requestedCount - The # of desired return values
        fromDate - The lower bound date
        toDate - The upper bound date
        logLevel - The minimum log level to display
        onlyLevel - True to only display messsage for "logLevel"
        listOfModules - List of modules to match
        nameValueMap - NVP's to match
        Returns:
      • getInstanceLogFileNames

        public List<String> getInstanceLogFileNames​(String instanceName)
      • fetchRecordsUsingQuery

        protected AttributeList fetchRecordsUsingQuery​(LogFile logFile,
                                                       long startingRecord,
                                                       boolean next,
                                                       boolean forward,
                                                       long requestedCount,
                                                       Date fromDate,
                                                       Date toDate,
                                                       String logLevel,
                                                       boolean onlyLevel,
                                                       List listOfModules,
                                                       Properties nameValueMap,
                                                       String anySearch)
        Internal method that will be called from getLogRecordsUsingQuery()
      • getLogFile

        public LogFile getLogFile()
        This provides access to the LogFile object.
      • getLogFile

        public LogFile getLogFile​(String fileName)
        This fetches or updates logFileCache entries.

        _REVISIT_: We may want to limit the entries here as each logFile takes up so much of memory to maintain indexes

      • allChecks

        protected boolean allChecks​(LogFile.LogEntry entry,
                                    Date fromDate,
                                    Date toDate,
                                    String queryLevel,
                                    boolean onlyLevel,
                                    List listOfModules,
                                    Properties nameValueMap,
                                    String anySearch)
        This method accepts the first line of the Log Record and checks to see if it matches the query.
      • dateTimeCheck

        protected boolean dateTimeCheck​(Date loggedDateTime,
                                        Date fromDateTime,
                                        Date toDateTime)
      • levelCheck

        protected boolean levelCheck​(String loggedLevel,
                                     String queryLevelIn,
                                     boolean isOnlyLevelFlag)
      • moduleCheck

        protected boolean moduleCheck​(String loggerName,
                                      List modules)
      • nameValueCheck

        protected boolean nameValueCheck​(String loggedNameValuePairs,
                                         Properties queriedNameValueMap)
      • messageDataCheck

        protected boolean messageDataCheck​(String message,
                                           String nvp,
                                           String anySearch)