View Javadoc

    1   //========================================================================
    2   //$Id: JettyLog.java 4185 2008-12-12 17:49:55Z janb $
    3   //Copyright 2006 Mort Bay Consulting Pty. Ltd.
    4   //------------------------------------------------------------------------
    5   //Licensed under the Apache License, Version 2.0 (the "License");
    6   //you may not use this file except in compliance with the License.
    7   //You may obtain a copy of the License at
    8   //http://www.apache.org/licenses/LICENSE-2.0
    9   //Unless required by applicable law or agreed to in writing, software
    10  //distributed under the License is distributed on an "AS IS" BASIS,
    11  //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //See the License for the specific language governing permissions and
    13  //limitations under the License.
    14  //========================================================================
    15
    16  package com.sun.org.apache.commons.logging.impl;
    17
    18  import com.sun.org.apache.commons.logging.Log;
    19
    20  /**
    21   * Log
    22   *
    23   * Bridges the com.sun.org.apache.commons.logging.Log to Jetty's log.
    24   *
    25   **/
    26  public class JettyLog implements Log
    27  {
    28      private String _name;
    29      private org.mortbay.log.Logger _logger;
    30
    31      /**
    32       *
    33       */
    34      public JettyLog(String name)
    35      {
    36          _name = name;
    37          _logger = org.mortbay.log.Log.getLogger(name);
    38      }
    39      public  void fatal (Object message)
    40      {
    41          _logger.warn(message.toString(), null, null);
    42      }
    43
    44      public  void fatal (Object message, Throwable t)
    45      {
    46          _logger.warn(message.toString(), t);
    47      }
    48
    49      public  void debug(Object message)
    50      {
    51          _logger.debug(message.toString(), null);
    52      }
    53
    54      public  void debug (Object message, Throwable t)
    55      {
    56          _logger.debug(message.toString(), t);
    57      }
    58
    59      public  void trace (Object message)
    60      {
    61          _logger.debug(message.toString(), null);
    62      }
    63
    64
    65      public  void info(Object message)
    66      {
    67         _logger.info(message.toString(), null, null);
    68      }
    69
    70      public  void error(Object message)
    71      {
    72         _logger.warn(message.toString(), null);
    73      }
    74
    75      public  void error(Object message, Throwable cause)
    76      {
    77          _logger.warn(message.toString(), cause);
    78      }
    79
    80      public  void warn(Object message)
    81      {
    82          _logger.warn(message.toString(), null);
    83      }
    84
    85      public  boolean isDebugEnabled ()
    86      {
    87          return _logger.isDebugEnabled();
    88      }
    89
    90      public  boolean isWarnEnabled ()
    91      {
    92          return _logger.isDebugEnabled();
    93      }
    94
    95      public  boolean isInfoEnabled ()
    96      {
    97          return true;
    98      }
    99
    100
    101     public  boolean isErrorEnabled ()
    102     {
    103         return true;
    104     }
    105
    106
    107     public  boolean isTraceEnabled ()
    108     {
    109         return _logger.isDebugEnabled();
    110     }
    111
    112 }