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  package org.apache.myfaces.trinidad.logging;
20  
21  import java.util.Locale;
22  import java.util.MissingResourceException;
23  import java.util.ResourceBundle;
24  import java.util.logging.Handler;
25  import java.util.logging.Level;
26  import java.util.logging.LogRecord;
27  import java.util.logging.Logger;
28  import org.apache.myfaces.trinidad.util.FastMessageFormat;
29  
30  /**
31   * TrinidadLogger wraps JDK 1.4 logging to provided a large number of 
32   * extra convenience methods.  TrinidadLoggers are created off of
33   * Packages or Classes (not arbitrary names) to force
34   * proper logging hierarchies.
35   *
36   */
37  public class TrinidadLogger 
38  {
39    
40    private TrinidadLogger(Logger log)
41    {
42      if (log == null)
43        throw new IllegalArgumentException(_LOG.getMessage(
44          "LOGGER_REQUIRED"));    
45      _log = log;
46    }
47  
48    /**
49     * Get the Java logger from an Trinidad Logger.
50     * 
51     * @return a java Logger instance
52     */
53    public Logger getLogger()
54    {
55      return _log;
56    }
57  
58    /**
59     * Find or create a logger for a named subsystem.  If a logger has
60     * already been created with the given name it is returned.  Otherwise
61     * a new logger is created.
62     * <p>
63     * If a new logger is created its log level will be configured
64     * based on the LogManager configuration and it will configured
65     * to also send logging output to its parent's handlers.  It will
66     * be registered in the LogManager global namespace.
67     * 
68     * @param name        A name for the logger.  This should
69     *                be a dot-separated name and should normally
70     *                be based on the package name or class name
71     *                of the subsystem, such as java.net
72     *                or javax.swing
73     * @return a suitable Logger
74     */
75    private static TrinidadLogger createTrinidadLogger(String name) 
76    {
77      if (name == null)
78        throw new IllegalArgumentException(_LOG.getMessage(
79          "LOGGER_NAME_REQUIRED"));
80      
81      Logger log;
82  
83      if (name.startsWith("org.apache.myfaces.trinidad."))
84      {
85        log = Logger.getLogger(name, _API_LOGGER_BUNDLE);
86      }
87      else if (name.startsWith("org.apache.myfaces.trinidadinternal."))
88      {
89        log = Logger.getLogger(name, _IMPL_LOGGER_BUNDLE);
90      }
91      else
92      {
93        log = Logger.getLogger(name);
94      }
95      
96      return new TrinidadLogger(log);
97    }
98  
99    /**
100    * Find or create a logger for a named subsystem.  If a logger has 
101    * already been created with the given name it is returned.  Otherwise
102    * a new logger is created.
103    * <p>
104    * If a new logger is created its log level will be configured
105    * based on the LogManager and it will configured to also send logging
106    * output to its parent loggers Handlers.  It will be registered in
107    * the LogManager global namespace.
108    * <p>
109    * If the named Logger already exists and does not yet have a
110    * localization resource bundle then the given resource bundle 
111    * name is used.  If the named Logger already exists and has
112    * a different resource bundle name then an IllegalArgumentException
113    * is thrown.
114    * <p>
115    * @param name    A name for the logger.  This should
116    *                be a dot-separated name and should normally
117    *                be based on the package name or class name
118    *                of the subsystem, such as java.net
119    *                or javax.swing
120    * @param     resourceBundleName  name of ResourceBundle to be used for localizing
121    *                messages for this logger.
122    * @return a suitable Logger
123    * @throws MissingResourceException if the named ResourceBundle cannot be found.
124    * @throws IllegalArgumentException if the Logger already exists and uses
125    *           a different resource bundle name.
126    */
127   private static TrinidadLogger createTrinidadLogger(String name, String resourceBundleName) 
128   {
129     if (name == null)
130       throw new IllegalArgumentException(_LOG.getMessage(
131         "LOGGER_NAME_REQUIRED"));
132    
133     Logger log = Logger.getLogger(name, resourceBundleName);
134 
135     return new TrinidadLogger(log);
136   }
137 
138 
139   /**
140    * Find or create a logger for a named subsystem.  If a logger has
141    * already been created with the given name it is returned.  Otherwise
142    * a new logger is created.
143    * <p>
144    * If a new logger is created its log level will be configured
145    * based on the LogManager configuration and it will configured
146    * to also send logging output to its parent's handlers.  It will
147    * be registered in the LogManager global namespace.
148    * 
149    * @param c       A class instance for the logger.  
150    * @return a suitable Logger
151    */
152   public static TrinidadLogger createTrinidadLogger(Class<?> c) 
153   {
154     if (c == null)
155       throw new IllegalArgumentException(_LOG.getMessage(
156         "CLASS_REQUIRED"));
157     String name = c.getName();
158     return createTrinidadLogger(name);
159   }
160 
161   /**
162    * Find or create a logger for a named subsystem.  If a logger has
163    * already been created with the given name it is returned.  Otherwise
164    * a new logger is created.
165    * <p>
166    * If a new logger is created its log level will be configured
167    * based on the LogManager configuration and it will configured
168    * to also send logging output to its parent's handlers.  It will
169    * be registered in the LogManager global namespace.
170    * 
171    * @param c       A class instance for the logger.  
172    * @param     resourceBundleName  name of ResourceBundle to be used for localizing
173    *                messages for this logger.
174    *        
175    * @return a suitable Logger
176    */
177   public static TrinidadLogger createTrinidadLogger(Class<?> c, String resourceBundleName) 
178   {
179     if (c == null)
180       throw new IllegalArgumentException(_LOG.getMessage(
181         "CLASS_REQUIRED"));
182     String name = c.getName();
183     return createTrinidadLogger(name, resourceBundleName);
184   }
185 
186  /**
187    * Find or create a logger for a named subsystem.  If a logger has
188    * already been created with the given name it is returned.  Otherwise
189    * a new logger is created.
190    * <p>
191    * If a new logger is created its log level will be configured
192    * based on the LogManager configuration and it will configured
193    * to also send logging output to its parent's handlers.  It will
194    * be registered in the LogManager global namespace.
195    * 
196    * @param p       A Package instance for the logger.  
197    * @return a suitable Logger
198    */
199 
200   public static TrinidadLogger createTrinidadLogger(Package p)
201   {
202     if (p == null)
203       throw new IllegalArgumentException(_LOG.getMessage(
204         "PACKAGE_REQUIRED"));
205     String name = p.getName();
206     return createTrinidadLogger(name);
207   }
208 
209 /**
210    * Find or create a logger for a named subsystem.  If a logger has
211    * already been created with the given name it is returned.  Otherwise
212    * a new logger is created.
213    * <p>
214    * If a new logger is created its log level will be configured
215    * based on the LogManager configuration and it will configured
216    * to also send logging output to its parent's handlers.  It will
217    * be registered in the LogManager global namespace.
218    * 
219    * @param p       A Package instance for the logger.  
220    * @param     resourceBundleName  name of ResourceBundle to be used for localizing
221    *                messages for this logger.
222    *        
223    * @return a suitable Logger
224    */
225 
226   public static TrinidadLogger createTrinidadLogger(Package p, String resourceBundleName)
227   {
228     if (p == null)
229       throw new IllegalArgumentException(_LOG.getMessage(
230         "PACKAGE_REQUIRED"));
231     String name = p.getName();
232     return createTrinidadLogger(name, resourceBundleName);
233   }
234 
235   /**
236    * Create an anonymous Logger.  The newly created Logger is not
237    * registered in the LogManager namespace.  There will be no
238    * access checks on updates to the logger.
239    * <p>
240    * This factory method is primarily intended for use from applets.
241    * Because the resulting Logger is anonymous it can be kept private
242    * by the creating class.  This removes the need for normal security
243    * checks, which in turn allows untrusted applet code to update
244    * the control state of the Logger.  For example an applet can do
245    * a setLevel or an addHandler on an anonymous Logger.
246    * <p>
247    * Even although the new logger is anonymous, it is configured
248    * to have the root logger ("") as its parent.  This means that
249    * by default it inherits its effective level and handlers
250    * from the root logger.
251    * <p>
252    *
253    * @return a newly created private Logger
254    */
255   public static TrinidadLogger getAnonymousLogger() 
256   {
257     return new TrinidadLogger(Logger.getAnonymousLogger());    
258   }
259 
260   /**
261    * Create an anonymous Logger.  The newly created Logger is not
262    * registered in the LogManager namespace.  There will be no
263    * access checks on updates to the logger.
264    * <p>
265    * This factory method is primarily intended for use from applets.
266    * Because the resulting Logger is anonymous it can be kept private
267    * by the creating class.  This removes the need for normal security
268    * checks, which in turn allows untrusted applet code to update
269    * the control state of the Logger.  For example an applet can do
270    * a setLevel or an addHandler on an anonymous Logger.
271    * <p>
272    * Even although the new logger is anonymous, it is configured
273    * to have the root logger ("") as its parent.  This means that
274    * by default it inherits its effective level and handlers
275    * from the root logger.
276    * <p>
277    * @param     resourceBundleName  name of ResourceBundle to be used for localizing
278    *                messages for this logger.
279    * @return a newly created private Logger
280    * @throws MissingResourceException if the named ResourceBundle cannot be found.
281    */
282   public static TrinidadLogger getAnonymousLogger(String resourceBundleName) 
283   {
284     return new TrinidadLogger(Logger.getAnonymousLogger(resourceBundleName));
285   }
286 
287 
288   /**
289    * Log a LogRecord.
290    * <p>
291    * All the other logging methods in this class call through
292    * this method to actually perform any logging.  Subclasses can
293    * override this single method to capture all log activity.
294    *
295    * @param record the LogRecord to be published
296    */
297   public void log(LogRecord record) 
298   {
299     _log.log(record);
300   }
301 
302 
303   //================================================================
304   // Start of convenience methods WITHOUT className and methodName
305   //================================================================
306 
307   /**
308    * Log a message, with no arguments.
309    * <p>
310    * If the logger is currently enabled for the given message 
311    * level then the given message is forwarded to all the
312    * registered output Handler objects.
313    * <p>
314    * @param   msg   The string message (or a key in the message catalog)
315    */
316   public void log(String msg) 
317   {
318     log(Level.FINE, msg);
319   }
320 
321   /**
322    * Log a message, with no arguments.
323    * <p>
324    * If the logger is currently enabled for the given message 
325    * level then the given message is forwarded to all the
326    * registered output Handler objects.
327    * <p>
328    * @param level   One of the message level identifiers, e.g. SEVERE
329    * @param   msg   The string message (or a key in the message catalog)
330    */
331   public void log(Level level, String msg) 
332   {
333     if (isLoggable(level))
334     {
335       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
336       doLog(lr);  
337     }
338   }
339 
340   /**
341    * Log a message, with one object parameter.
342    * <p>
343    * If the logger is currently enabled for the given message 
344    * level then a corresponding LogRecord is created and forwarded 
345    * to all the registered output Handler objects.
346    * <p>
347    * @param level   One of the message level identifiers, e.g. SEVERE
348    * @param   msg   The string message (or a key in the message catalog)
349    * @param   param1    parameter to the message
350    */
351   public void log(Level level, String msg, Object param1) 
352   {
353     if (isLoggable(level))
354     {
355       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
356       Object params[] = { param1};
357       lr.setParameters(params);
358       doLog(lr);  
359     }
360   }
361 
362   /**
363    * Log a message, with an array of object arguments.
364    * <p>
365    * If the logger is currently enabled for the given message 
366    * level then a corresponding LogRecord is created and forwarded 
367    * to all the registered output Handler objects.
368    * <p>
369    * @param level   One of the message level identifiers, e.g. SEVERE
370    * @param   msg   The string message (or a key in the message catalog)
371    * @param   params    array of parameters to the message
372    */
373   public void log(Level level, String msg, Object params[]) 
374   {
375     if (isLoggable(level))
376     {
377       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
378       lr.setParameters(params);
379       doLog(lr);  
380     }
381   }
382 
383   /**
384    * Log a message, with associated Throwable information.
385    * <p>
386    * If the logger is currently enabled for the given message 
387    * level then the given arguments are stored in a LogRecord
388    * which is forwarded to all registered output handlers.
389    * <p>
390    * Note that the thrown argument is stored in the LogRecord thrown
391    * property, rather than the LogRecord parameters property.  Thus is it
392    * processed specially by output Formatters and is not treated
393    * as a formatting parameter to the LogRecord message property.
394    * <p>
395    * @param level   One of the message level identifiers, e.g. SEVERE
396    * @param   msg   The string message (or a key in the message catalog)
397    * @param   thrown  Throwable associated with log message.
398    */
399   public void log(Level level, String msg, Throwable thrown) 
400   {
401     if (isLoggable(level))
402     {
403       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
404       lr.setThrown(thrown);
405       doLog(lr);  
406     }
407   }
408 
409   //================================================================
410   // Start of convenience methods WITH className and methodName
411   //================================================================
412 
413   /**
414    * Log a message, specifying source class and method,
415    * with no arguments.
416    * <p>
417    * If the logger is currently enabled for the given message 
418    * level then the given message is forwarded to all the
419    * registered output Handler objects.
420    * <p>
421    * @param level   One of the message level identifiers, e.g. SEVERE
422    * @param   sourceClass    name of class that issued the logging request
423    * @param   sourceMethod   name of method that issued the logging request
424    * @param   msg   The string message (or a key in the message catalog)
425    */
426   public void logp(Level level, String sourceClass, String sourceMethod, String msg) 
427   {
428     if (isLoggable(level))
429     {
430       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
431       lr.setSourceClassName(sourceClass);
432       lr.setSourceMethodName(sourceMethod);
433       doLog(lr);  
434     }
435   }
436 
437   /**
438    * Log a message, specifying source class and method,
439    * with a single object parameter to the log message.
440    * <p>
441    * If the logger is currently enabled for the given message 
442    * level then a corresponding LogRecord is created and forwarded 
443    * to all the registered output Handler objects.
444    * <p>
445    * @param level   One of the message level identifiers, e.g. SEVERE
446    * @param   sourceClass    name of class that issued the logging request
447    * @param   sourceMethod   name of method that issued the logging request
448    * @param   msg    The string message (or a key in the message catalog)
449    * @param   param1    Parameter to the log message.
450    */
451   public void logp(Level level, String sourceClass, String sourceMethod,
452                    String msg, Object param1) 
453   {
454     if (isLoggable(level))
455     {
456       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
457       lr.setSourceClassName(sourceClass);
458       lr.setSourceMethodName(sourceMethod);
459       Object params[] = { param1};
460       lr.setParameters(params);
461       doLog(lr);  
462     }
463   }
464 
465   /**
466    * Log a message, specifying source class and method,
467    * with an array of object arguments.
468    * <p>
469    * If the logger is currently enabled for the given message 
470    * level then a corresponding LogRecord is created and forwarded 
471    * to all the registered output Handler objects.
472    * <p>
473    * @param level   One of the message level identifiers, e.g. SEVERE
474    * @param   sourceClass    name of class that issued the logging request
475    * @param   sourceMethod   name of method that issued the logging request
476    * @param   msg   The string message (or a key in the message catalog)
477    * @param   params    Array of parameters to the message
478    */
479   public void logp(Level level, String sourceClass, String sourceMethod,
480                    String msg, Object params[]) 
481   {
482     if (isLoggable(level))
483     {
484       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
485       lr.setSourceClassName(sourceClass);
486       lr.setSourceMethodName(sourceMethod);
487       lr.setParameters(params);
488       doLog(lr);  
489     }
490   }
491 
492   /**
493    * Log a message, specifying source class and method,
494    * with associated Throwable information.
495    * <p>
496    * If the logger is currently enabled for the given message 
497    * level then the given arguments are stored in a LogRecord
498    * which is forwarded to all registered output handlers.
499    * <p>
500    * Note that the thrown argument is stored in the LogRecord thrown
501    * property, rather than the LogRecord parameters property.  Thus is it
502    * processed specially by output Formatters and is not treated
503    * as a formatting parameter to the LogRecord message property.
504    * <p>
505    * @param level   One of the message level identifiers, e.g. SEVERE
506    * @param   sourceClass    name of class that issued the logging request
507    * @param   sourceMethod   name of method that issued the logging request
508    * @param   msg   The string message (or a key in the message catalog)
509    * @param   thrown  Throwable associated with log message.
510    */
511   public void logp(Level level, String sourceClass, String sourceMethod,
512                    String msg, Throwable thrown) 
513   {
514     if (isLoggable(level))
515     {
516       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
517       lr.setSourceClassName(sourceClass);
518       lr.setSourceMethodName(sourceMethod);
519       lr.setThrown(thrown);
520       doLog(lr);  
521     }
522   }
523 
524 
525   /**
526    * Log a message, specifying source class, method, and resource bundle name
527    * with no arguments.
528    * <p>
529    * If the logger is currently enabled for the given message 
530    * level then the given message is forwarded to all the
531    * registered output Handler objects.
532    * <p>
533    * The msg string is localized using the named resource bundle.  If the
534    * resource bundle name is null, then the msg string is not localized.
535    * <p>
536    * @param level   One of the message level identifiers, e.g. SEVERE
537    * @param   sourceClass    name of class that issued the logging request
538    * @param   sourceMethod   name of method that issued the logging request
539    * @param   bundleName     name of resource bundle to localize msg
540    * @param   msg   The string message (or a key in the message catalog)
541    * @throws  MissingResourceException if no suitable ResourceBundle can
542    *        be found.
543    */
544 
545   public void logrb(Level level, String sourceClass, String sourceMethod, 
546                     String bundleName, String msg) 
547   {
548     if (isLoggable(level))
549     {
550       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
551       lr.setSourceClassName(sourceClass);
552       lr.setSourceMethodName(sourceMethod);
553       doLog(lr,bundleName);  
554     }
555   }
556 
557   /**
558    * Log a message, specifying source class, method, and resource bundle name,
559    * with a single object parameter to the log message.
560    * <p>
561    * If the logger is currently enabled for the given message 
562    * level then a corresponding LogRecord is created and forwarded 
563    * to all the registered output Handler objects.
564    * <p>
565    * The msg string is localized using the named resource bundle.  If the
566    * resource bundle name is null, then the msg string is not localized.
567    * <p>
568    * @param level   One of the message level identifiers, e.g. SEVERE
569    * @param   sourceClass    name of class that issued the logging request
570    * @param   sourceMethod   name of method that issued the logging request
571    * @param   bundleName     name of resource bundle to localize msg
572    * @param   msg    The string message (or a key in the message catalog)
573    * @param   param1    Parameter to the log message.
574    * @throws  MissingResourceException if no suitable ResourceBundle can
575    *        be found.
576    */
577   public void logrb(Level level, String sourceClass, String sourceMethod,
578                     String bundleName, String msg, Object param1) 
579   {
580     if (isLoggable(level))
581     {
582       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
583       lr.setSourceClassName(sourceClass);
584       lr.setSourceMethodName(sourceMethod);
585       Object params[] = { param1};
586       lr.setParameters(params);
587       doLog(lr,bundleName);  
588     }
589   }
590 
591   /**
592    * Log a message, specifying source class, method, and resource bundle name,
593    * with an array of object arguments.
594    * <p>
595    * If the logger is currently enabled for the given message 
596    * level then a corresponding LogRecord is created and forwarded 
597    * to all the registered output Handler objects.
598    * <p>
599    * The msg string is localized using the named resource bundle.  If the
600    * resource bundle name is null, then the msg string is not localized.
601    * <p>
602    * @param level   One of the message level identifiers, e.g. SEVERE
603    * @param   sourceClass    name of class that issued the logging request
604    * @param   sourceMethod   name of method that issued the logging request
605    * @param   bundleName     name of resource bundle to localize msg
606    * @param   msg   The string message (or a key in the message catalog)
607    * @param   params    Array of parameters to the message
608    * @throws  MissingResourceException if no suitable ResourceBundle can
609    *        be found.
610    */
611   public void logrb(Level level, String sourceClass, String sourceMethod,
612                     String bundleName, String msg, Object params[]) 
613   {
614     if (isLoggable(level))
615     {
616       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
617       lr.setSourceClassName(sourceClass);
618       lr.setSourceMethodName(sourceMethod);
619       lr.setParameters(params);
620       doLog(lr,bundleName);  
621     }
622   }
623 
624   /**
625    * Log a message, specifying source class, method, and resource bundle name,
626    * with associated Throwable information.
627    * <p>
628    * If the logger is currently enabled for the given message 
629    * level then the given arguments are stored in a LogRecord
630    * which is forwarded to all registered output handlers.
631    * <p>
632    * The msg string is localized using the named resource bundle.  If the
633    * resource bundle name is null, then the msg string is not localized.
634    * <p>
635    * Note that the thrown argument is stored in the LogRecord thrown
636    * property, rather than the LogRecord parameters property.  Thus is it
637    * processed specially by output Formatters and is not treated
638    * as a formatting parameter to the LogRecord message property.
639    * <p>
640    * @param level   One of the message level identifiers, e.g. SEVERE
641    * @param   sourceClass    name of class that issued the logging request
642    * @param   sourceMethod   name of method that issued the logging request
643    * @param   bundleName     name of resource bundle to localize msg
644    * @param   msg   The string message (or a key in the message catalog)
645    * @param   thrown  Throwable associated with log message.
646    * @throws  MissingResourceException if no suitable ResourceBundle can
647    *        be found.
648    */
649   public void logrb(Level level, String sourceClass, String sourceMethod,
650                     String bundleName, String msg, Throwable thrown) 
651   {
652     if (isLoggable(level))
653     {
654       TrinidadLogRecord lr = new TrinidadLogRecord(level, msg);
655       lr.setSourceClassName(sourceClass);
656       lr.setSourceMethodName(sourceMethod);
657       lr.setThrown(thrown);
658       doLog(lr,bundleName);  
659     }
660   }
661 
662 
663   //======================================================================
664   // Start of convenience methods for logging method entries and returns.
665   //======================================================================
666 
667   /**
668    * Log a method entry.
669    * <p>
670    * This is a convenience method that can be used to log entry
671    * to a method.  A LogRecord with message "ENTRY", log level
672    * FINER, and the given sourceMethod and sourceClass is logged.
673    * <p>
674    * @param   sourceClass    name of class that issued the logging request
675    * @param   sourceMethod   name of method that is being entered
676    */
677   public void entering(String sourceClass, String sourceMethod) 
678   {
679     _log.entering(sourceClass, sourceMethod);
680   }
681 
682   /**
683    * Log a method entry, with one parameter.
684    * <p>
685    * This is a convenience method that can be used to log entry
686    * to a method.  A LogRecord with message "ENTRY {0}", log level
687    * FINER, and the given sourceMethod, sourceClass, and parameter
688    * is logged.
689    * <p>
690    * @param   sourceClass    name of class that issued the logging request
691    * @param   sourceMethod   name of method that is being entered
692    * @param   param1           parameter to the method being entered
693    */
694   public void entering(String sourceClass, String sourceMethod, Object param1) 
695   {
696     _log.entering(sourceClass, sourceMethod, param1);
697   }
698 
699   /**
700    * Log a method entry, with an array of parameters.
701    * <p>
702    * This is a convenience method that can be used to log entry
703    * to a method.  A LogRecord with message "ENTRY" (followed by a 
704    * format {N} indicator for each entry in the parameter array), 
705    * log level FINER, and the given sourceMethod, sourceClass, and 
706    * parameters is logged.
707    * <p>
708    * @param   sourceClass    name of class that issued the logging request
709    * @param   sourceMethod   name of method that is being entered
710    * @param   params           array of parameters to the method being entered
711    */
712   public void entering(String sourceClass, String sourceMethod, Object params[]) 
713   {
714     _log.entering(sourceClass, sourceMethod, params);
715   }
716 
717   /**
718    * Log a method return.
719    * <p>
720    * This is a convenience method that can be used to log returning
721    * from a method.  A LogRecord with message "RETURN", log level
722    * FINER, and the given sourceMethod and sourceClass is logged.
723    * <p>
724    * @param   sourceClass    name of class that issued the logging request
725    * @param   sourceMethod   name of the method 
726    */
727   public void exiting(String sourceClass, String sourceMethod) 
728   {
729     _log.exiting(sourceClass, sourceMethod);
730   }
731 
732 
733   /**
734    * Log a method return, with result object.
735    * <p>
736    * This is a convenience method that can be used to log returning
737    * from a method.  A LogRecord with message "RETURN {0}", log level
738    * FINER, and the gives sourceMethod, sourceClass, and result
739    * object is logged.
740    * <p>
741    * @param   sourceClass    name of class that issued the logging request
742    * @param   sourceMethod   name of the method 
743    * @param   result  Object that is being returned
744    */
745   public void exiting(String sourceClass, String sourceMethod, Object result) 
746   {
747     _log.exiting(sourceClass, sourceMethod, result);
748   }
749 
750   /**
751    * Log throwing an exception.
752    * <p>
753    * This is a convenience method to log that a method is
754    * terminating by throwing an exception.  The logging is done 
755    * using the FINER level.
756    * <p>
757    * If the logger is currently enabled for the given message 
758    * level then the given arguments are stored in a LogRecord
759    * which is forwarded to all registered output handlers.  The
760    * LogRecord's message is set to "THROW".
761    * <p>
762    * Note that the thrown argument is stored in the LogRecord thrown
763    * property, rather than the LogRecord parameters property.  Thus is it
764    * processed specially by output Formatters and is not treated
765    * as a formatting parameter to the LogRecord message property.
766    * <p>
767    * @param   sourceClass    name of class that issued the logging request
768    * @param   sourceMethod  name of the method.
769    * @param   thrown  The Throwable that is being thrown.
770    */
771   public void throwing(String sourceClass, String sourceMethod, Throwable thrown) 
772   {
773     _log.throwing(sourceClass, sourceMethod, thrown);
774   }
775 
776   //=======================================================================
777   // Start of simple convenience methods using level names as method names
778   //=======================================================================
779 
780   /**
781    * Log a SEVERE message.
782    * <p>
783    * If the logger is currently enabled for the SEVERE message 
784    * level then the given message is forwarded to all the
785    * registered output Handler objects.
786    * <p>
787    * @param   msg   The string message (or a key in the message catalog)
788    */
789   public void severe(String msg) 
790   {
791     //_log.severe(msg);
792     log(Level.SEVERE,msg);
793   }
794 
795   /**
796    * Log a WARNING message.
797    * <p>
798    * If the logger is currently enabled for the WARNING message 
799    * level then the given message is forwarded to all the
800    * registered output Handler objects.
801    * <p>
802    * @param   msg   The string message (or a key in the message catalog)
803    */
804   public void warning(String msg) 
805   {
806     //_log.warning(msg);
807     log(Level.WARNING,msg);
808   }
809 
810   /**
811    * Log an INFO message.
812    * <p>
813    * If the logger is currently enabled for the INFO message 
814    * level then the given message is forwarded to all the
815    * registered output Handler objects.
816    * <p>
817    * @param   msg   The string message (or a key in the message catalog)
818    */
819   public void info(String msg) 
820   {
821     //_log.info(msg);
822     log(Level.INFO,msg);
823   }
824 
825   /**
826    * Log a CONFIG message.
827    * <p>
828    * If the logger is currently enabled for the CONFIG message 
829    * level then the given message is forwarded to all the
830    * registered output Handler objects.
831    * <p>
832    * @param   msg   The string message (or a key in the message catalog)
833    */
834   public void config(String msg) 
835   {
836     //_log.config(msg);
837     log(Level.CONFIG,msg);
838   }
839 
840   /**
841    * Log a FINE message.
842    * <p>
843    * If the logger is currently enabled for the FINE message 
844    * level then the given message is forwarded to all the
845    * registered output Handler objects.
846    * <p>
847    * @param   msg   The string message (or a key in the message catalog)
848    */
849   public void fine(String msg) 
850   {
851     //_log.fine(msg);
852     log(Level.FINE,msg);
853   }
854 
855   /**
856    * Log a FINER message.
857    * <p>
858    * If the logger is currently enabled for the FINER message 
859    * level then the given message is forwarded to all the
860    * registered output Handler objects.
861    * <p>
862    * @param   msg   The string message (or a key in the message catalog)
863    */
864   public void finer(String msg) 
865   {
866     //_log.finer(msg);
867     log(Level.FINER,msg);
868   }
869 
870   /**
871    * Log a FINEST message.
872    * <p>
873    * If the logger is currently enabled for the FINEST message 
874    * level then the given message is forwarded to all the
875    * registered output Handler objects.
876    * <p>
877    * @param   msg   The string message (or a key in the message catalog)
878    */
879   public void finest(String msg) 
880   {
881     //_log.finest(msg);
882     log(Level.FINEST,msg);
883   }
884 
885   /**
886     * Log throwing an exception.
887     * 
888     * Comparing to Java Logging function
889     * 
890     *     Logger.throwing(sourceClass, sourceMethod, thrown) 
891     * 
892     * this function takes one more parameter "level" so that developers can 
893     * specify the logging level of an exception. Developers should pass value
894     * for the "level" parameter using following convention,
895     * <p>
896     * Level.SEVERE -- Serious exceptions or error conditions such that an 
897     * application can no longer run.
898     * <p>
899     * Level.WARNING -- Exceptions or errors that are not fatal, but an 
900     * application will run with some problems.
901     * <p>
902     * 
903     * @param level Java Logging level
904     * @param sourceClass name of class that issued the logging request
905     * @param sourceMethod name of the method
906     * @param thrown The Throwable that is being thrown
907     */
908   public void throwing(
909                       Level  level,
910                       String sourceClass,
911                       String sourceMethod,
912                       Throwable thrown
913                       )
914   {
915     logp(level, sourceClass, sourceMethod, null, thrown);
916   }
917 
918   /**
919    * Log a SEVERE message, with no arguments.
920    * <p>
921    * The message is forwarded to appropriate Java Logger objects. 
922    * <p>
923    * @param sourceClass  the name of the class that issued the logging request 
924    * @param sourceMethod the name of the method that issued the logging request 
925    * @param msg          the string message (or a key in the resource bundle)
926    */
927   public void severe(
928                     String sourceClass,
929                     String sourceMethod,
930                     String msg
931                     )
932   {
933     logp(Level.SEVERE, sourceClass, sourceMethod, msg);
934   }
935 
936   /**
937    * Log a SEVERE message, with one object parameter.
938    * <p>
939    * The message is forwarded to appropriate Java Logger objects. 
940    * <p>
941    * @param sourceClass  the name of the class that issued the logging request 
942    * @param sourceMethod the name of the method that issued the logging request 
943    * @param msg          the string message (or a key in the resource bundle)
944    * @param param1       a parameter to the message
945    */
946   public void severe(
947                     String sourceClass,
948                     String sourceMethod,
949                     String msg,
950                     Object param1
951                     )
952   {
953     logp(Level.SEVERE, sourceClass, sourceMethod, msg, param1);
954   }
955 
956   /**
957    * Log a SEVERE message, with an array of object arguments.
958    * <p>
959    * The message is forwarded to appropriate Java Logger objects. 
960    * <p>
961    * @param sourceClass  the name of the class that issued the logging request 
962    * @param sourceMethod the name of the method that issued the logging request 
963    * @param msg          the string message (or a key in the resource bundle)
964    * @param params       an array of parameters to the message
965    */
966   public void severe(
967                     String sourceClass,
968                     String sourceMethod,
969                     String msg,
970                     Object[] params
971                     )
972   {
973     logp(Level.SEVERE, sourceClass, sourceMethod, msg, params);
974   }
975 
976   /**
977    * Log a WARNING message, with no arguments.
978    * <p>
979    * The message is forwarded to appropriate Java Logger objects. 
980    * <p>
981    * @param sourceClass  the name of the class that issued the logging request 
982    * @param sourceMethod the name of the method that issued the logging request 
983    * @param msg          the string message (or a key in the resource bundle)
984    */
985   public void warning(
986                      String sourceClass,
987                      String sourceMethod,
988                      String msg
989                      )
990   {
991     logp(Level.WARNING, sourceClass, sourceMethod, msg);
992   }
993 
994   /**
995    * Log a WARNING message, with one object parameter.
996    * <p>
997    * The message is forwarded to appropriate Java Logger objects. 
998    * <p>
999    * @param sourceClass  the name of the class that issued the logging request 
1000    * @param sourceMethod the name of the method that issued the logging request 
1001    * @param msg          the string message (or a key in the resource bundle)
1002    * @param param1       a parameter to the message
1003    */
1004   public void warning(
1005                      String sourceClass,
1006                      String sourceMethod,
1007                      String msg,
1008                      Object param1
1009                      )
1010   {
1011     logp(Level.WARNING, sourceClass, sourceMethod, msg, param1);
1012   }
1013 
1014   /**
1015    * Log a WARNING message, with an array of object arguments.
1016    * <p>
1017    * The message is forwarded to appropriate Java Logger objects. 
1018    * <p>
1019    * @param sourceClass  the name of the class that issued the logging request 
1020    * @param sourceMethod the name of the method that issued the logging request 
1021    * @param msg          the string message (or a key in the resource bundle)
1022    * @param params       an array of parameters to the message
1023    */
1024   public void warning(
1025                      String sourceClass,
1026                      String sourceMethod,
1027                      String msg,
1028                      Object[] params
1029                      )
1030   {
1031     logp(Level.WARNING, sourceClass, sourceMethod, msg, params);
1032   }
1033 
1034   /**
1035    * Log a INFO message, with no arguments.
1036    * <p>
1037    * The message is forwarded to appropriate Java Logger objects. 
1038    * <p>
1039    * @param sourceClass  the name of the class that issued the logging request 
1040    * @param sourceMethod the name of the method that issued the logging request 
1041    * @param msg          the string message (or a key in the resource bundle)
1042    */
1043   public void info(
1044                   String sourceClass,
1045                   String sourceMethod,
1046                   String msg
1047                   )
1048   {
1049     logp(Level.INFO, sourceClass, sourceMethod, msg);
1050   }
1051 
1052   /**
1053    * Log a INFO message, with one object parameter.
1054    * <p>
1055    * The message is forwarded to appropriate Java Logger objects. 
1056    * <p>
1057    * @param sourceClass  the name of the class that issued the logging request 
1058    * @param sourceMethod the name of the method that issued the logging request 
1059    * @param msg          the string message (or a key in the resource bundle)
1060    * @param param1       a parameter to the message
1061    */
1062   public void info(
1063                   String sourceClass,
1064                   String sourceMethod,
1065                   String msg,
1066                   Object param1
1067                   )
1068   {
1069     logp(Level.INFO, sourceClass, sourceMethod, msg, param1);
1070   }
1071 
1072   /**
1073    * Log a INFO message, with an array of object arguments.
1074    * <p>
1075    * The message is forwarded to appropriate Java Logger objects. 
1076    * <p>
1077    * @param sourceClass  the name of the class that issued the logging request 
1078    * @param sourceMethod the name of the method that issued the logging request 
1079    * @param msg          the string message (or a key in the resource bundle)
1080    * @param params       an array of parameters to the message
1081    */
1082   public void info(
1083                   String sourceClass,
1084                   String sourceMethod,
1085                   String msg,
1086                   Object[] params
1087                   )
1088   {
1089     logp(Level.INFO, sourceClass, sourceMethod, msg, params);
1090   }
1091 
1092   /**
1093    * Log a CONFIG message, with no arguments.
1094    * <p>
1095    * The message is forwarded to appropriate Java Logger objects. 
1096    * <p>
1097    * @param sourceClass  the name of the class that issued the logging request 
1098    * @param sourceMethod the name of the method that issued the logging request 
1099    * @param msg          the string message (or a key in the resource bundle)
1100    */
1101   public void config(
1102                     String sourceClass,
1103                     String sourceMethod,
1104                     String msg
1105                     )
1106   {
1107     logp(Level.CONFIG, sourceClass, sourceMethod, msg);
1108   }
1109 
1110   /**
1111    * Log a CONFIG message, with one object parameter.
1112    * <p>
1113    * The message is forwarded to appropriate Java Logger objects. 
1114    * <p>
1115    * @param sourceClass  the name of the class that issued the logging request 
1116    * @param sourceMethod the name of the method that issued the logging request 
1117    * @param msg          the string message (or a key in the resource bundle)
1118    * @param param1       a parameter to the message
1119    */
1120   public void config(
1121                     String sourceClass,
1122                     String sourceMethod,
1123                     String msg,
1124                     Object param1
1125                     )
1126   {
1127     _log.logp(Level.CONFIG, sourceClass, sourceMethod, msg, param1);
1128   }
1129 
1130   /**
1131    * Log a CONFIG message, with an array of object arguments.
1132    * <p>
1133    * The message is forwarded to appropriate Java Logger objects. 
1134    * <p>
1135    * @param sourceClass  the name of the class that issued the logging request 
1136    * @param sourceMethod the name of the method that issued the logging request 
1137    * @param msg          the string message (or a key in the resource bundle)
1138    * @param params       an array of parameters to the message
1139    */
1140   public void config(
1141                     String sourceClass,
1142                     String sourceMethod,
1143                     String msg,
1144                     Object[] params
1145                     )
1146   {
1147     logp(Level.CONFIG, sourceClass, sourceMethod, msg, params);
1148   }
1149 
1150   /**
1151    * Log a FINE message, with no arguments.
1152    * <p>
1153    * The message is forwarded to appropriate Java Logger objects. 
1154    * <p>
1155    * @param sourceClass  the name of the class that issued the logging request 
1156    * @param sourceMethod the name of the method that issued the logging request 
1157    * @param msg          the string message (or a key in the resource bundle)
1158    */
1159   public void fine(
1160                   String sourceClass,
1161                   String sourceMethod,
1162                   String msg
1163                   )
1164   {
1165     logp(Level.FINE, sourceClass, sourceMethod, msg);
1166   }
1167 
1168   /**
1169    * Log a FINE message, with one object parameter.
1170    * <p>
1171    * The message is forwarded to appropriate Java Logger objects. 
1172    * <p>
1173    * @param sourceClass  the name of the class that issued the logging request 
1174    * @param sourceMethod the name of the method that issued the logging request 
1175    * @param msg          the string message (or a key in the resource bundle)
1176    * @param param1       a parameter to the message
1177    */
1178   public void fine(
1179                   String sourceClass,
1180                   String sourceMethod,
1181                   String msg,
1182                   Object param1
1183                   )
1184   {
1185     logp(Level.FINE, sourceClass, sourceMethod, msg, param1);
1186   }
1187 
1188   /**
1189    * Log a FINE message, with an array of object arguments.
1190    * <p>
1191    * The message is forwarded to appropriate Java Logger objects. 
1192    * <p>
1193    * @param sourceClass  the name of the class that issued the logging request 
1194    * @param sourceMethod the name of the method that issued the logging request 
1195    * @param msg          the string message (or a key in the resource bundle)
1196    * @param params       an array of parameters to the message
1197    */
1198   public void fine(
1199                   String sourceClass,
1200                   String sourceMethod,
1201                   String msg,
1202                   Object[] params
1203                   )
1204   {
1205     logp(Level.FINE, sourceClass, sourceMethod, msg, params);
1206   }
1207 
1208   /**
1209    * Log a FINER message, with no arguments.
1210    * <p>
1211    * The message is forwarded to appropriate Java Logger objects. 
1212    * <p>
1213    * @param sourceClass  the name of the class that issued the logging request 
1214    * @param sourceMethod the name of the method that issued the logging request 
1215    * @param msg          the string message (or a key in the resource bundle)
1216    */
1217   public void finer(
1218                    String sourceClass,
1219                    String sourceMethod,
1220                    String msg
1221                    )
1222   {
1223     logp(Level.FINER, sourceClass, sourceMethod, msg);
1224   }
1225 
1226   /**
1227    * Log a FINER message, with one object parameter.
1228    * <p>
1229    * The message is forwarded to appropriate Java Logger objects. 
1230    * <p>
1231    * @param sourceClass  the name of the class that issued the logging request 
1232    * @param sourceMethod the name of the method that issued the logging request 
1233    * @param msg          the string message (or a key in the resource bundle)
1234    * @param param1       a parameter to the message
1235    */
1236   public void finer(
1237                    String sourceClass,
1238                    String sourceMethod,
1239                    String msg,
1240                    Object param1
1241                    )
1242   {
1243     logp(Level.FINER, sourceClass, sourceMethod, msg, param1);
1244   }
1245 
1246   /**
1247    * Log a FINER message, with an array of object arguments.
1248    * <p>
1249    * The message is forwarded to appropriate Java Logger objects. 
1250    * <p>
1251    * @param sourceClass  the name of the class that issued the logging request 
1252    * @param sourceMethod the name of the method that issued the logging request 
1253    * @param msg          the string message (or a key in the resource bundle)
1254    * @param params       an array of parameters to the message
1255    */
1256   public void finer(
1257                    String sourceClass,
1258                    String sourceMethod,
1259                    String msg,
1260                    Object[] params
1261                    )
1262   {
1263     logp(Level.FINER, sourceClass, sourceMethod, msg, params);
1264   }
1265 
1266   /**
1267    * Log a FINEST message, with no arguments.
1268    * <p>
1269    * The message is forwarded to appropriate Java Logger objects. 
1270    * <p>
1271    * @param sourceClass  the name of the class that issued the logging request 
1272    * @param sourceMethod the name of the method that issued the logging request 
1273    * @param msg          the string message (or a key in the resource bundle)
1274    */
1275   public void finest(
1276                     String sourceClass,
1277                     String sourceMethod,
1278                     String msg
1279                     )
1280   {
1281     logp(Level.FINEST, sourceClass, sourceMethod, msg);
1282   }
1283 
1284   /**
1285    * Log a FINEST message, with one object parameter.
1286    * <p>
1287    * The message is forwarded to appropriate Java Logger objects. 
1288    * <p>
1289    * @param sourceClass  the name of the class that issued the logging request 
1290    * @param sourceMethod the name of the method that issued the logging request 
1291    * @param msg          the string message (or a key in the resource bundle)
1292    * @param param1       a parameter to the message
1293    */
1294   public void finest(
1295                     String sourceClass,
1296                     String sourceMethod,
1297                     String msg,
1298                     Object param1
1299                     )
1300   {
1301     logp(Level.FINEST, sourceClass, sourceMethod, msg, param1);
1302   }
1303 
1304   /**
1305    * Log a FINEST message, with an array of object arguments.