View Javadoc

1   /****************************************************************
2    * Licensed to the Apache Software Foundation (ASF) under one   *
3    * or more contributor license agreements.  See the NOTICE file *
4    * distributed with this work for additional information        *
5    * regarding copyright ownership.  The ASF licenses this file   *
6    * to you under the Apache License, Version 2.0 (the            *
7    * "License"); you may not use this file except in compliance   *
8    * with the License.  You may obtain a copy of the License at   *
9    *                                                              *
10   *   http://www.apache.org/licenses/LICENSE-2.0                 *
11   *                                                              *
12   * Unless required by applicable law or agreed to in writing,   *
13   * software distributed under the License is distributed on an  *
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15   * KIND, either express or implied.  See the License for the    *
16   * specific language governing permissions and limitations      *
17   * under the License.                                           *
18   ****************************************************************/
19  
20  package org.apache.james.jspf.core;
21  
22  /**
23   * This is a facade for the different logging subsystems. It offers a simplified
24   * interface that follows IOC patterns and a simplified priority/level/severity
25   * abstraction.
26   */
27  public interface Logger {
28      /**
29       * Log a debug message.
30       * 
31       * @param message
32       *            the message
33       */
34      public void debug(String message);
35  
36      /**
37       * Log a debug message.
38       * 
39       * @param message
40       *            the message
41       * @param throwable
42       *            the throwable
43       */
44      public void debug(String message, Throwable throwable);
45  
46      /**
47       * Determine if messages of priority "debug" will be logged.
48       * 
49       * @return true if "debug" messages will be logged
50       */
51      public boolean isDebugEnabled();
52  
53      /**
54       * Log a info message.
55       * 
56       * @param message
57       *            the message
58       */
59      public void info(String message);
60  
61      /**
62       * Log a info message.
63       * 
64       * @param message
65       *            the message
66       * @param throwable
67       *            the throwable
68       */
69      public void info(String message, Throwable throwable);
70  
71      /**
72       * Determine if messages of priority "info" will be logged.
73       * 
74       * @return true if "info" messages will be logged
75       */
76      public boolean isInfoEnabled();
77  
78      /**
79       * Log a warn message.
80       * 
81       * @param message
82       *            the message
83       */
84      public void warn(String message);
85  
86      /**
87       * Log a warn message.
88       * 
89       * @param message
90       *            the message
91       * @param throwable
92       *            the throwable
93       */
94      public void warn(String message, Throwable throwable);
95  
96      /**
97       * Determine if messages of priority "warn" will be logged.
98       * 
99       * @return true if "warn" messages will be logged
100      */
101     public boolean isWarnEnabled();
102 
103     /**
104      * Log a error message.
105      * 
106      * @param message
107      *            the message
108      */
109     public void error(String message);
110 
111     /**
112      * Log a error message.
113      * 
114      * @param message
115      *            the message
116      * @param throwable
117      *            the throwable
118      */
119     public void error(String message, Throwable throwable);
120 
121     /**
122      * Determine if messages of priority "error" will be logged.
123      * 
124      * @return true if "error" messages will be logged
125      */
126     public boolean isErrorEnabled();
127 
128     /**
129      * Log a fatalError message.
130      * 
131      * @param message
132      *            the message
133      */
134     public void fatalError(String message);
135 
136     /**
137      * Log a fatalError message.
138      * 
139      * @param message
140      *            the message
141      * @param throwable
142      *            the throwable
143      */
144     public void fatalError(String message, Throwable throwable);
145 
146     /**
147      * Determine if messages of priority "fatalError" will be logged.
148      * 
149      * @return true if "fatalError" messages will be logged
150      */
151     public boolean isFatalErrorEnabled();
152 
153     /**
154      * Create a new child logger. The name of the child logger is
155      * [current-loggers-name].[passed-in-name] Throws
156      * <code>IllegalArgumentException</code> if name has an empty element name
157      * 
158      * @param name
159      *            the subname of this logger
160      * @return the new logger
161      */
162     public Logger getChildLogger(String name);
163 }