View Javadoc

1   package org.apache.turbine.util;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * 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, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.apache.commons.logging.LogFactory;
20  import org.apache.turbine.TurbineConstants;
21  
22  /***
23   * A facade class for Turbine Logging
24   *
25   * Use this class to conveniently access the system logging facility.
26   *
27   * @author <a href="mailto:Tomasz.Zielinski@e-point.pl">Tomasz Zielinski</a>
28   * @author <a href="mailto:hps@intermeta.de>Henning P. Schmiedehausen</a>
29   * @version $Id: Log.java 264148 2005-08-29 14:21:04Z henning $
30   * @deprecated Use the commons.logging system for logging
31   */
32  public class Log
33  {
34      /***
35       * This method returns default logger for Turbine System
36       *
37       * @return The default logger for system.
38       * @deprecated Use the commons.logging system for logging
39       */
40      public static org.apache.commons.logging.Log getLogger()
41      {
42          return LogFactory.getLog(TurbineConstants.DEFAULT_LOGGER);
43      }
44  
45      /***
46       * This method returns logger with given name if such logger exists,
47       * or the default logger.
48       *
49       * @return The default logger for system.
50       * @deprecated Use the commons.logging system for logging
51       */
52      public static org.apache.commons.logging.Log getLogger(String logName)
53      {
54          org.apache.commons.logging.Log log = LogFactory.getLog(logName);
55  
56          if (log == null)
57          {
58              log = getLogger();
59          }
60          return log;
61      }
62  
63      /***
64       * This is a log method with logLevel == DEBUG, printing is done by
65       * the default logger
66       *
67       * @deprecated Use the commons.logging system for logging
68       */
69      public static void debug(String message)
70      {
71          getLogger().debug(message);
72      }
73  
74      /***
75       * This is a log method with logLevel == DEBUG, printing is done by
76       * the default logger
77       *
78       * @deprecated Use the commons.logging system for logging
79       */
80      public static void debug(String message, Throwable t)
81      {
82          getLogger().debug(message, t);
83      }
84  
85      /***
86       * This is a log method with logLevel == DEBUG, printing is done by
87       * the given logger
88       *
89       * @deprecated Use the commons.logging system for logging
90       */
91      public static void debug(String logName, String message, Throwable t)
92      {
93          getLogger(logName).debug(message, t);
94      }
95  
96      /***
97       * This is a log method with logLevel == DEBUG, printing is done by
98       * the given logger
99       *
100      * @deprecated Use the commons.logging system for logging
101      */
102     public static void debug(String logName, String message)
103     {
104         getLogger(logName).debug(message);
105     }
106 
107     /***
108      * This is a log method with logLevel == INFO, printing is done by
109      * the default logger
110      *
111      * @deprecated Use the commons.logging system for logging
112      */
113     public static void info(String message)
114     {
115         getLogger().info(message);
116     }
117 
118     /***
119      * This is a log method with logLevel == INFO, printing is done by
120      * the default logger
121      *
122      * @deprecated Use the commons.logging system for logging
123      */
124     public static void info(String message, Throwable t)
125     {
126         getLogger().info(message, t);
127     }
128 
129     /***
130      * This is a log method with logLevel == INFO, printing is done by
131      * the given logger
132      *
133      * @deprecated Use the commons.logging system for logging
134      */
135     public static void info(String logName, String message)
136     {
137         getLogger(logName).info(message);
138     }
139 
140     /***
141      * This is a log method with logLevel == INFO, printing is done by
142      * the given logger
143      *
144      * @deprecated Use the commons.logging system for logging
145      */
146     public static void info(String logName, String message, Throwable t)
147     {
148         getLogger(logName).info(message, t);
149     }
150 
151     /***
152      * This is a log method with logLevel == WARN, printing is done by
153      * the default logger
154      *
155      * @deprecated Use the commons.logging system for logging
156      */
157     public static void warn(String message)
158     {
159         getLogger().warn(message);
160     }
161 
162     /***
163      * This is a log method with logLevel == WARN, printing is done by
164      * the default logger
165      *
166      * @deprecated Use the commons.logging system for logging
167      */
168     public static void warn(String message, Throwable t)
169     {
170         getLogger().warn(message, t);
171     }
172 
173     /***
174      * This is a log method with logLevel == WARN, printing is done by
175      * the given logger
176      *
177      * @deprecated Use the commons.logging system for logging
178      */
179     public static void warn(String logName, String message)
180     {
181         getLogger(logName).warn(message);
182     }
183 
184     /***
185      * This is a log method with logLevel == WARN, printing is done by
186      * the given logger
187      *
188      * @deprecated Use the commons.logging system for logging
189      */
190     public static void warn(String logName, String message, Throwable t)
191     {
192         getLogger(logName).warn(message, t);
193     }
194 
195     /***
196      * This is a log method with logLevel == ERROR, printing is done by
197      * the default logger
198      *
199      * @deprecated Use the commons.logging system for logging
200      */
201     public static void error(String message)
202     {
203         getLogger().error(message);
204     }
205 
206     /***
207      * This is a log method with logLevel == ERROR, printing is done by
208      * the default logger
209      *
210      * @deprecated Use the commons.logging system for logging
211      */
212     public static void error(String message, Throwable t)
213     {
214         getLogger().error(message, t);
215     }
216 
217     /***
218      * This is a log method with logLevel == ERROR, printing is done by
219      * the given logger
220      *
221      * @deprecated Use the commons.logging system for logging
222      */
223     public static void error(String logName, String message)
224     {
225         getLogger(logName).error(message);
226     }
227 
228     /***
229      * This is a log method with logLevel == ERROR, printing is done by
230      * the given logger
231      *
232      * @deprecated Use the commons.logging system for logging
233      */
234     public static void error(String logName, String message, Throwable t)
235     {
236         getLogger(logName).error(message, t);
237     }
238 
239     /***
240      * This is a log method with logLevel == ERROR, printing is done by
241      * the default logger
242      *
243      * @deprecated Use the commons.logging system for logging
244      */
245     public static void error(Throwable e)
246     {
247         error("", e);
248     }
249 }