Home » apache-tomcat-6.0.26-src » org.apache » juli » logging » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */ 
   17   
   18   
   19   package org.apache.juli.logging;
   20   
   21   /**
   22    * <p>A simple logging interface abstracting logging APIs.  In order to be
   23    * instantiated successfully by {@link LogFactory}, classes that implement
   24    * this interface must have a constructor that takes a single String
   25    * parameter representing the "name" of this Log.</p>
   26    *
   27    * <p> The six logging levels used by <code>Log</code> are (in order):
   28    * <ol>
   29    * <li>trace (the least serious)</li>
   30    * <li>debug</li>
   31    * <li>info</li>
   32    * <li>warn</li>
   33    * <li>error</li>
   34    * <li>fatal (the most serious)</li>
   35    * </ol>
   36    * The mapping of these log levels to the concepts used by the underlying
   37    * logging system is implementation dependent.
   38    * The implemention should ensure, though, that this ordering behaves
   39    * as expected.</p>
   40    *
   41    * <p>Performance is often a logging concern.
   42    * By examining the appropriate property,
   43    * a component can avoid expensive operations (producing information
   44    * to be logged).</p>
   45    *
   46    * <p> For example,
   47    * <code><pre>
   48    *    if (log.isDebugEnabled()) {
   49    *        ... do something expensive ...
   50    *        log.debug(theResult);
   51    *    }
   52    * </pre></code>
   53    * </p>
   54    *
   55    * <p>Configuration of the underlying logging system will generally be done
   56    * external to the Logging APIs, through whatever mechanism is supported by
   57    * that system.</p>
   58    *
   59    * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
   60    * @author Rod Waldhoff
   61    * @version $Id: Log.java 467222 2006-10-24 03:17:11Z markt $
   62    */
   63   public interface Log {
   64   
   65   
   66       // ----------------------------------------------------- Logging Properties
   67   
   68   
   69       /**
   70        * <p> Is debug logging currently enabled? </p>
   71        *
   72        * <p> Call this method to prevent having to perform expensive operations
   73        * (for example, <code>String</code> concatenation)
   74        * when the log level is more than debug. </p>
   75        */
   76       public boolean isDebugEnabled();
   77   
   78   
   79       /**
   80        * <p> Is error logging currently enabled? </p>
   81        *
   82        * <p> Call this method to prevent having to perform expensive operations
   83        * (for example, <code>String</code> concatenation)
   84        * when the log level is more than error. </p>
   85        */
   86       public boolean isErrorEnabled();
   87   
   88   
   89       /**
   90        * <p> Is fatal logging currently enabled? </p>
   91        *
   92        * <p> Call this method to prevent having to perform expensive operations
   93        * (for example, <code>String</code> concatenation)
   94        * when the log level is more than fatal. </p>
   95        */
   96       public boolean isFatalEnabled();
   97   
   98   
   99       /**
  100        * <p> Is info logging currently enabled? </p>
  101        *
  102        * <p> Call this method to prevent having to perform expensive operations
  103        * (for example, <code>String</code> concatenation)
  104        * when the log level is more than info. </p>
  105        */
  106       public boolean isInfoEnabled();
  107   
  108   
  109       /**
  110        * <p> Is trace logging currently enabled? </p>
  111        *
  112        * <p> Call this method to prevent having to perform expensive operations
  113        * (for example, <code>String</code> concatenation)
  114        * when the log level is more than trace. </p>
  115        */
  116       public boolean isTraceEnabled();
  117   
  118   
  119       /**
  120        * <p> Is warn logging currently enabled? </p>
  121        *
  122        * <p> Call this method to prevent having to perform expensive operations
  123        * (for example, <code>String</code> concatenation)
  124        * when the log level is more than warn. </p>
  125        */
  126       public boolean isWarnEnabled();
  127   
  128   
  129       // -------------------------------------------------------- Logging Methods
  130   
  131   
  132       /**
  133        * <p> Log a message with trace log level. </p>
  134        *
  135        * @param message log this message
  136        */
  137       public void trace(Object message);
  138   
  139   
  140       /**
  141        * <p> Log an error with trace log level. </p>
  142        *
  143        * @param message log this message
  144        * @param t log this cause
  145        */
  146       public void trace(Object message, Throwable t);
  147   
  148   
  149       /**
  150        * <p> Log a message with debug log level. </p>
  151        *
  152        * @param message log this message
  153        */
  154       public void debug(Object message);
  155   
  156   
  157       /**
  158        * <p> Log an error with debug log level. </p>
  159        *
  160        * @param message log this message
  161        * @param t log this cause
  162        */
  163       public void debug(Object message, Throwable t);
  164   
  165   
  166       /**
  167        * <p> Log a message with info log level. </p>
  168        *
  169        * @param message log this message
  170        */
  171       public void info(Object message);
  172   
  173   
  174       /**
  175        * <p> Log an error with info log level. </p>
  176        *
  177        * @param message log this message
  178        * @param t log this cause
  179        */
  180       public void info(Object message, Throwable t);
  181   
  182   
  183       /**
  184        * <p> Log a message with warn log level. </p>
  185        *
  186        * @param message log this message
  187        */
  188       public void warn(Object message);
  189   
  190   
  191       /**
  192        * <p> Log an error with warn log level. </p>
  193        *
  194        * @param message log this message
  195        * @param t log this cause
  196        */
  197       public void warn(Object message, Throwable t);
  198   
  199   
  200       /**
  201        * <p> Log a message with error log level. </p>
  202        *
  203        * @param message log this message
  204        */
  205       public void error(Object message);
  206   
  207   
  208       /**
  209        * <p> Log an error with error log level. </p>
  210        *
  211        * @param message log this message
  212        * @param t log this cause
  213        */
  214       public void error(Object message, Throwable t);
  215   
  216   
  217       /**
  218        * <p> Log a message with fatal log level. </p>
  219        *
  220        * @param message log this message
  221        */
  222       public void fatal(Object message);
  223   
  224   
  225       /**
  226        * <p> Log an error with fatal log level. </p>
  227        *
  228        * @param message log this message
  229        * @param t log this cause
  230        */
  231       public void fatal(Object message, Throwable t);
  232   
  233   
  234   }

Home » apache-tomcat-6.0.26-src » org.apache » juli » logging » [javadoc | source]