KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > Logger


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

27
28
29 package org.apache.catalina;
30
31
32 import java.beans.PropertyChangeListener JavaDoc;
33
34
35 /**
36  * A <b>Logger</b> is a generic interface for the message and exception
37  * logging methods of the ServletContext interface. Loggers can be
38  * attached at any Container level, but will typically only be attached
39  * to a Context, or higher level, Container.
40  *
41  * @author Craig R. McClanahan
42  * @version $Revision: 1.2 $ $Date: 2005/12/08 01:27:18 $
43  */

44
45 public interface Logger {
46
47
48     // ----------------------------------------------------- Manifest Constants
49

50
51     /**
52      * Verbosity level constants for log messages that may be filtered
53      * by the underlying logger.
54      */

55
56     public static final int FATAL = Integer.MIN_VALUE;
57
58     public static final int ERROR = 1;
59
60     public static final int WARNING = 2;
61
62     public static final int INFORMATION = 3;
63
64     public static final int DEBUG = 4;
65
66
67     // ------------------------------------------------------------- Properties
68

69
70     /**
71      * Return the Container with which this Logger has been associated.
72      */

73     public Container getContainer();
74
75
76     /**
77      * Set the Container with which this Logger has been associated.
78      *
79      * @param container The associated Container
80      */

81     public void setContainer(Container container);
82
83
84     /**
85      * Return descriptive information about this Logger implementation and
86      * the corresponding version number, in the format
87      * <code>&lt;description&gt;/&lt;version&gt;</code>.
88      */

89     public String JavaDoc getInfo();
90
91
92     /**
93      * Return the verbosity level of this logger. Messages logged with a
94      * higher verbosity than this level will be silently ignored.
95      */

96     public int getVerbosity();
97
98
99     /**
100      * Set the verbosity level of this logger. Messages logged with a
101      * higher verbosity than this level will be silently ignored.
102      *
103      * @param verbosity The new verbosity level
104      */

105     public void setVerbosity(int verbosity);
106
107
108     // --------------------------------------------------------- Public Methods
109

110
111     /**
112      * Add a property change listener to this component.
113      *
114      * @param listener The listener to add
115      */

116     public void addPropertyChangeListener(PropertyChangeListener JavaDoc listener);
117
118
119     /**
120      * Writes the specified message to a servlet log file, usually an event
121      * log. The name and type of the servlet log is specific to the
122      * servlet container. This message will be logged unconditionally.
123      *
124      * @param message A <code>String</code> specifying the message to be
125      * written to the log file
126      */

127     public void log(String JavaDoc message);
128
129
130     /**
131      * Writes the specified exception, and message, to a servlet log file.
132      * The implementation of this method should call
133      * <code>log(msg, exception)</code> instead. This method is deprecated
134      * in the ServletContext interface, but not deprecated here to avoid
135      * many useless compiler warnings. This message will be logged
136      * unconditionally.
137      *
138      * @param exception An <code>Exception</code> to be reported
139      * @param msg The associated message string
140      */

141     public void log(Exception JavaDoc exception, String JavaDoc msg);
142
143
144     /**
145      * Writes an explanatory message and a stack trace for a given
146      * <code>Throwable</code> exception to the servlet log file. The name
147      * and type of the servlet log file is specific to the servlet container,
148      * usually an event log. This message will be logged unconditionally.
149      *
150      * @param message A <code>String</code> that describes the error or
151      * exception
152      * @param throwable The <code>Throwable</code> error or exception
153      */

154     public void log(String JavaDoc message, Throwable JavaDoc throwable);
155
156
157     /**
158      * Writes the specified message to the servlet log file, usually an event
159      * log, if the logger is set to a verbosity level equal to or higher than
160      * the specified value for this message.
161      *
162      * @param message A <code>String</code> specifying the message to be
163      * written to the log file
164      * @param verbosity Verbosity level of this message
165      */

166     public void log(String JavaDoc message, int verbosity);
167
168
169     /**
170      * Writes the specified message and exception to the servlet log file,
171      * usually an event log, if the logger is set to a verbosity level equal
172      * to or higher than the specified value for this message.
173      *
174      * @param message A <code>String</code> that describes the error or
175      * exception
176      * @param throwable The <code>Throwable</code> error or exception
177      * @param verbosity Verbosity level of this message
178      */

179     public void log(String JavaDoc message, Throwable JavaDoc throwable, int verbosity);
180
181
182     /**
183      * Remove a property change listener from this component.
184      *
185      * @param listener The listener to remove
186      */

187     public void removePropertyChangeListener(PropertyChangeListener JavaDoc listener);
188
189
190 }
191
Popular Tags