KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > ext > logging > LogQuery


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24
25 package com.sun.appserv.management.ext.logging;
26
27 import java.util.Map JavaDoc;
28 import java.util.Set JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Date JavaDoc;
31
32 import java.util.logging.Level JavaDoc;
33
34 import java.io.Serializable JavaDoc;
35
36 import javax.management.Attribute JavaDoc;
37 import javax.management.openmbean.CompositeData JavaDoc;
38
39 /**
40     Provides access to log messages already present in the log file.
41     
42     @since AS 9.0
43  */

44 public interface LogQuery
45 {
46     /**
47         The lowest supported log level for which queries may be performed.
48      */

49     public static final String JavaDoc LOWEST_SUPPORTED_QUERY_LEVEL =
50         Level.WARNING.toString();
51     
52     /**
53         Query a server log file for records beginning at index <code>startIndex</code>.
54         <p>
55         The <code>name</code> parameter may be {@link LogFileAccess#MOST_RECENT_NAME}
56         to query the current server log file, or may be any specific server log
57         file as returned by {@link LogFileAccess#getLogFileNames}.
58         <p>
59         To query log records starting at the beginning of the file and moving forward,
60         use startIndex={@link #FIRST_RECORD}. To query records beginning at the end of the
61         file and moving backwards, use startIndex={@link #LAST_RECORD} and
62         specify <code>searchForward=false</code>.
63         <p>
64         If <code>searchForward</code> is true,
65         then log records beginning with
66         <code>startRecord</code> (inclusive) and later
67         are considered by the query.<br>
68         If <code>searchForward</code> is false,
69         then log records beginning at
70         <code>startRecord - 1</code> and earlier are considered by the query.
71         <p>
72         Because a log file could be deleted
73         <p>
74         <b>QUESTIONS TO RESOLVE<b>
75         <ul>
76         <li>What are the legal keys and values of 'nameValueMap'</li>
77         </ul>
78         <p>
79
80         @param name a specific log file name or {@link LogFileAccess#MOST_RECENT_NAME}
81         @param startIndex the location within the LogFile to begin.
82         @param searchForward true to move forward, false to move backward from <code>startIndex</code>
83         @param maxRecords the maximum number of results to be returned, {@link #ALL_RECORDS} for all
84         @param fromTime the lower bound time, may be null (inclusive)
85         @param toTime the upper bound time, may be null (exclusive)
86         @param logLevel the minimum log level to return, see {@link Level}
87         @param modules one or more modules as defined in {@link LogModuleNames} or
88                                 any valid Logger name
89         @param nameValuePairs name-value pairs to match. Names need not be unique.
90         @return LogQueryResult when using AMX client proxy.
91                                 Actual type returned from the MBean is List&lt;Serializable[]>
92                                 The first Serializable[] is a String[] which contains the field names.
93                                 Subsequent Serializable[] each represent a log record with each element representing
94                                 a field within that log record.
95         @see LogRecordFields
96         @see LogModuleNames
97      */

98         public LogQueryResult
99     queryServerLog(
100         String JavaDoc name,
101         long startIndex,
102         boolean searchForward,
103         int maxRecords,
104         Long JavaDoc fromTime,
105         Long JavaDoc toTime,
106         String JavaDoc logLevel,
107         Set JavaDoc<String JavaDoc> modules,
108         List JavaDoc<Attribute JavaDoc> nameValuePairs);
109     
110     /**
111         Value for the <code>maximumNumberOfResults</code> parameter to
112         {@link #queryServerLog} which returns all results.
113      */

114     public static final int ALL_RECORDS = -1;
115      
116     /**
117         Value for the <code>startIndex</code> parameter to
118         {@link #queryServerLog}.
119      */

120     public static final int FIRST_RECORD = 0;
121     
122     /**
123         Value for the <code>startIndex</code> parameter to
124         {@link #queryServerLog}.
125      */

126     public static final int LAST_RECORD = -1;
127     
128     /**
129      */

130     public String JavaDoc[] getDiagnosticCauses( String JavaDoc messageID );
131     
132     /**
133      */

134     public String JavaDoc[] getDiagnosticChecks( String JavaDoc messageID );
135     
136     
137     /**
138      */

139     public String JavaDoc getDiagnosticURI( String JavaDoc messageID );
140     
141 }
142
143
144
145
146
147
148
Popular Tags