KickJava   Java API By Example, From Geeks To Geeks.

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


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
28 /**
29     Provides access to log files.
30     
31     @since AS 9.0
32  */

33 public interface LogFileAccess
34 {
35     /**
36         Value meaning the most current version of the log file.
37      */

38     public static final String JavaDoc MOST_RECENT_NAME = "MostRecentLogFileName";
39      
40     /**
41         Key designating the server.log log files.
42         <i>Not necessarily the same as the file name of the log file</i>.
43      */

44     public static final String JavaDoc SERVER_KEY = "server";
45     
46     /**
47         Key designating the access.log log file.
48         <i>Not necessarily the same as the file name of the log file</i>.
49      */

50     public static final String JavaDoc ACCESS_KEY = "access";
51     
52     /**
53         Keys which may be used to specify which log file to access.
54         Legal values include:
55         <ul>
56         <li>{@link #SERVER_KEY}</li>
57         <li>{@link #ACCESS_KEY} <b>is not supported</b></li>
58         </ul>
59         @return a String[] of the legal keys which designate log files
60      */

61     public String JavaDoc[] getLogFileKeys();
62     
63     
64     /**
65         The names returned are <i>not</i> full paths but the simple file
66         names of the log files.
67         The last name in the resulting String[] will always be that of the
68         current log file. In other words if the String[] las length 3,
69         then result[2] will be the name of the current log file.
70         <p>
71         Note that it is possible for log file rotation to occur after making
72         this call, thus rendering the list incomplete.
73         <p>
74         The resulting names may be passed to {@link #getLogFile} to retrieve
75         the contents.
76         <p>
77         The only legal key supported is {@link #SERVER_KEY}.
78         
79         @param key a key specifying the type of log file
80         @return String[] of all log filenames
81      */

82     public String JavaDoc[] getLogFileNames( final String JavaDoc key );
83     
84     /**
85         The entire specified log file is read, converted into a String, and returned.
86         The resulting String may be quite large.
87         <p>
88         The only legal key supported is {@link #SERVER_KEY}.
89         
90         @param key a legal key designating a log file
91         @param fileName a log file name as returned by {@link #getLogFileNames} or
92         {@link #MOST_RECENT_NAME} if current log file is desired.
93         @return the contents of the specified log file in a String
94         @see #getLogFileKeys
95      */

96     public String JavaDoc getLogFile( final String JavaDoc key, final String JavaDoc fileName );
97     
98     /**
99         Rotate all log files as soon as possible. May return
100         prior to the rotation occuring.
101      */

102     public void rotateAllLogFiles();
103     
104     
105     /**
106         Rotate the log file of the specified type. Legal values are those
107         returned by {@link #getLogFileKeys}.
108         Legal values include:
109         <ul>
110         <li>{@link #SERVER_KEY}</li>
111         <li>{@link #ACCESS_KEY} <b>is not supported</b></li>
112         </ul>
113         @param key
114      */

115     public void rotateLogFile( String JavaDoc key );
116 }
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Popular Tags