View Javadoc

    1   //========================================================================
    2   //$Id: JettyLog.java 1106 2006-10-17 17:00:06Z 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;
    17
    18
    19  /**
    20   * Log
    21   *
    22   * Bridges the com.sun.org.apache.commons.logging.Log to Jetty's log.
    23   *
    24   **/
    25  public class JettyLog implements Log
    26  {
    27      private String _name;
    28      private org.mortbay.log.Logger _logger;
    29
    30      /**
    31       *
    32       */
    33      public JettyLog(String name)
    34      {
    35          _name = name;
    36          _logger = org.mortbay.log.Log.getLogger(name);
    37      }
    38      public  void fatal (Object message)
    39      {
    40          _logger.warn(message.toString(), null, null);
    41      }
    42
    43      public  void fatal (Object message, Throwable t)
    44      {
    45          _logger.warn(message.toString(), t);
    46      }
    47
    48      public  void debug(Object message)
    49      {
    50          _logger.debug(message.toString(), null);
    51      }
    52
    53      public  void debug (Object message, Throwable t)
    54      {
    55          _logger.debug(message.toString(), t);
    56      }
    57
    58      public  void trace (Object message)
    59      {
    60          _logger.debug(message.toString(), null);
    61      }
    62
    63
    64      public  void info(Object message)
    65      {
    66         _logger.info(message.toString(), null, null);
    67      }
    68
    69      public  void error(Object message)
    70      {
    71         _logger.warn(message.toString(), null);
    72      }
    73
    74      public  void error(Object message, Throwable cause)
    75      {
    76          _logger.warn(message.toString(), cause);
    77      }
    78
    79      public  void warn(Object message)
    80      {
    81          _logger.warn(message.toString(), null);
    82      }
    83
    84      public  boolean isDebugEnabled ()
    85      {
    86          return _logger.isDebugEnabled();
    87      }
    88
    89      public  boolean isWarnEnabled ()
    90      {
    91          return _logger.isDebugEnabled();
    92      }
    93
    94      public  boolean isInfoEnabled ()
    95      {
    96          return true;
    97      }
    98
    99
    100     public  boolean isErrorEnabled ()
    101     {
    102         return true;
    103     }
    104
    105
    106     public  boolean isTraceEnabled ()
    107     {
    108         return _logger.isDebugEnabled();
    109     }
    110
    111 }