001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.system.logging;
017:
018: import java.io.Serializable;
019:
020: /**
021: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
022: */
023: public interface SystemLog {
024: /**
025: * The most search lines that will ever be returned, no matter what you
026: * ask for. This is to conserve memory and transfer bandwidth.
027: */
028: public final static int MAX_SEARCH_RESULTS = 1000;
029:
030: /**
031: * Gets the name of the file that configures the log system
032: */
033: String getConfigFileName();
034:
035: /**
036: * Sets the name of the file that the log system should configure itself from.
037: */
038: void setConfigFileName(String fileName);
039:
040: /**
041: * Gets the name of the log level used for the root logger.
042: */
043: String getRootLoggerLevel();
044:
045: /**
046: * Sets the name of the log level used for the root logger. Legal values
047: * are defined in GeronimoLogging.java (currently TRACE, DEBUG, INFO,
048: * WARN, ERROR, FATAL)
049: */
050: void setRootLoggerLevel(String level);
051:
052: /**
053: * Indicates how often the log system should check to see if its
054: * configuration file has been updated.
055: */
056: int getRefreshPeriodSeconds();
057:
058: /**
059: * Sets how often the log system should check to see if its
060: * configuration file has been updated.
061: */
062: void setRefreshPeriodSeconds(int seconds);
063:
064: /**
065: * Gets the name of all log files used by this log system. Typically there
066: * is only one, but specialized cases may use more.
067: */
068: String[] getLogFileNames();
069:
070: /**
071: * Searches the log for records matching the specified parameters. The
072: * maximum results returned will be the lesser of 1000 and the
073: * provided maxResults argument.
074: *
075: * @see #MAX_SEARCH_RESULTS
076: */
077: SearchResults getMatchingItems(String logFile, Integer firstLine,
078: Integer lastLine, String minLevel, String regex,
079: int maxResults, boolean includeStackTraces);
080:
081: public static class LogMessage implements Serializable {
082: private final int lineNumber;
083: private final String lineContent;
084:
085: public LogMessage(int lineNumber, String lineContent) {
086: this .lineNumber = lineNumber;
087: this .lineContent = lineContent;
088: }
089:
090: public int getLineNumber() {
091: return lineNumber;
092: }
093:
094: public String getLineContent() {
095: return lineContent;
096: }
097: }
098:
099: public static class SearchResults implements Serializable {
100: private final int lineCount; // total lines in file
101: private final LogMessage[] results;
102: private final boolean capped;
103:
104: public SearchResults(int lineCount, LogMessage[] results,
105: boolean capped) {
106: this .lineCount = lineCount;
107: this .results = results;
108: this .capped = capped;
109: }
110:
111: public int getLineCount() {
112: return lineCount;
113: }
114:
115: public LogMessage[] getResults() {
116: return results;
117: }
118:
119: public boolean isCapped() {
120: return capped;
121: }
122: }
123: }
|