KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > system > logging > SystemLog


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 JavaDoc;
20
21 /**
22  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
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     public final static int MAX_SEARCH_RESULTS = 1000;
30     /**
31      * Gets the name of the file that configures the log system
32      */

33     String JavaDoc getConfigFileName();
34     /**
35      * Sets the name of the file that the log system should configure itself from.
36      */

37     void setConfigFileName(String JavaDoc fileName);
38     /**
39      * Gets the name of the log level used for the root logger.
40      */

41     String JavaDoc getRootLoggerLevel();
42     /**
43      * Sets the name of the log level used for the root logger. Legal values
44      * are defined in GeronimoLogging.java (currently TRACE, DEBUG, INFO,
45      * WARN, ERROR, FATAL)
46      */

47     void setRootLoggerLevel(String JavaDoc level);
48     /**
49      * Indicates how often the log system should check to see if its
50      * configuration file has been updated.
51      */

52     int getRefreshPeriodSeconds();
53     /**
54      * Sets how often the log system should check to see if its
55      * configuration file has been updated.
56      */

57     void setRefreshPeriodSeconds(int seconds);
58     /**
59      * Gets the name of all log files used by this log system. Typically there
60      * is only one, but specialized cases may use more.
61      */

62     String JavaDoc[] getLogFileNames();
63     /**
64      * Searches the log for records matching the specified parameters. The
65      * maximum results returned will be the lesser of 1000 and the
66      * provided maxResults argument.
67      *
68      * @see #MAX_SEARCH_RESULTS
69      */

70     SearchResults getMatchingItems(String JavaDoc logFile, Integer JavaDoc firstLine, Integer JavaDoc lastLine, String JavaDoc minLevel,
71                                   String JavaDoc regex, int maxResults, boolean includeStackTraces);
72
73     public static class LogMessage implements Serializable JavaDoc {
74         private final int lineNumber;
75         private final String JavaDoc lineContent;
76
77         public LogMessage(int lineNumber, String JavaDoc lineContent) {
78             this.lineNumber = lineNumber;
79             this.lineContent = lineContent;
80         }
81
82         public int getLineNumber() {
83             return lineNumber;
84         }
85
86         public String JavaDoc getLineContent() {
87             return lineContent;
88         }
89     }
90
91     public static class SearchResults implements Serializable JavaDoc {
92         private final int lineCount; // total lines in file
93
private final LogMessage[] results;
94         private final boolean capped;
95
96         public SearchResults(int lineCount, LogMessage[] results, boolean capped) {
97             this.lineCount = lineCount;
98             this.results = results;
99             this.capped = capped;
100         }
101
102         public int getLineCount() {
103             return lineCount;
104         }
105
106         public LogMessage[] getResults() {
107             return results;
108         }
109
110         public boolean isCapped() {
111             return capped;
112         }
113     }
114 }
115
Popular Tags