Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.system.logging » [javadoc | source]
    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   package org.apache.geronimo.system.logging;
   18   
   19   import java.io.Serializable;
   20   
   21   /**
   22    * @version $Rev: 651902 $ $Date: 2008-04-27 02:28:37 -0700 (Sun, 27 Apr 2008) $
   23    */
   24   public interface SystemLog {
   25       /**
   26        * The most search lines that will ever be returned, no matter what you
   27        * ask for.  This is to conserve memory and transfer bandwidth.
   28        */
   29       int MAX_SEARCH_RESULTS = 1000;
   30       
   31       /**
   32        * Gets the name of the file that configures the log system
   33        */
   34       String getConfigFileName();
   35       
   36       /**
   37        * Sets the name of the file that the log system should configure itself from.
   38        */
   39       void setConfigFileName(String fileName);
   40       
   41       /**
   42        * Gets the name of the log level used for the root logger.
   43        */
   44       String getRootLoggerLevel();
   45       
   46       /**
   47        * Sets the name of the log level used for the root logger.
   48        */
   49       void setRootLoggerLevel(String level);
   50       
   51       /**
   52        * Indicates how often the log system should check to see if its
   53        * configuration file has been updated.
   54        */
   55       int getRefreshPeriodSeconds();
   56       
   57       /**
   58        * Sets how often the log system should check to see if its
   59        * configuration file has been updated.
   60        */
   61       void setRefreshPeriodSeconds(int seconds);
   62       
   63       /**
   64        * Gets the name of all log files used by this log system.  Typically there
   65        * is only one, but specialized cases may use more.
   66        */
   67       String[] getLogFileNames();
   68       
   69       /**
   70        * Searches the log for records matching the specified parameters.  The
   71        * maximum results returned will be the lesser of 1000 and the
   72        * provided maxResults argument.
   73        *
   74        * @see #MAX_SEARCH_RESULTS
   75        */
   76       SearchResults getMatchingItems(String logFile, Integer firstLine, Integer lastLine, String minLevel,
   77                                      String regex, int maxResults, boolean includeStackTraces);
   78   
   79       public static class LogMessage implements Serializable {
   80           private final int lineNumber;
   81           private final String lineContent;
   82   
   83           public LogMessage(int lineNumber, String lineContent) {
   84               this.lineNumber = lineNumber;
   85               this.lineContent = lineContent;
   86           }
   87   
   88           public int getLineNumber() {
   89               return lineNumber;
   90           }
   91   
   92           public String getLineContent() {
   93               return lineContent;
   94           }
   95       }
   96   
   97       public static class SearchResults implements Serializable {
   98           private final int lineCount; // total lines in file
   99           private final LogMessage[] results;
  100           private final boolean capped;
  101   
  102           public SearchResults(int lineCount, LogMessage[] results, boolean capped) {
  103               this.lineCount = lineCount;
  104               this.results = results;
  105               this.capped = capped;
  106           }
  107   
  108           public int getLineCount() {
  109               return lineCount;
  110           }
  111   
  112           public LogMessage[] getResults() {
  113               return results;
  114           }
  115   
  116           public boolean isCapped() {
  117               return capped;
  118           }
  119       }
  120   }

Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.system.logging » [javadoc | source]