View Javadoc

    1   // ========================================================================
    2   // Licensed under the Apache License, Version 2.0 (the "License");
    3   // you may not use this file except in compliance with the License.
    4   // You may obtain a copy of the License at
    5   // http://www.apache.org/licenses/LICENSE-2.0
    6   // Unless required by applicable law or agreed to in writing, software
    7   // distributed under the License is distributed on an "AS IS" BASIS,
    8   // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    9   // See the License for the specific language governing permissions and
    10  // limitations under the License.
    11  // ========================================================================
    12  package com.sun.org.apache.commons.logging;
    13
    14  import java.net.URLClassLoader;
    15  import java.util.HashMap;
    16  import java.util.Map;
    17
    18
    19  /**
    20   * LogFactory
    21   *
    22   * Bridges com.sun.org.apache.commons.logging.LogFactory to
    23   * Jetty's log.
    24   *
    25   */
    26  public class LogFactory
    27  {
    28      private static Map _logs = new HashMap();
    29
    30      public static Log getLog (Class c)
    31      {
    32          Log log = (Log)_logs.get(c.getName());
    33          if (log == null)
    34          {
    35              log = new JettyLog(c.getName());
    36              _logs.put(c.getName(), log);
    37          }
    38
    39          return log;
    40      }
    41
    42      public static Log getLog (String str)
    43      {
    44          Log log = (Log)_logs.get(str);
    45          if (log == null)
    46          {
    47              log = new JettyLog(str);
    48              _logs.put(str, log);
    49          }
    50          return log;
    51      }
    52
    53      public static void release (URLClassLoader cl)
    54      {
    55          releaseAll ();
    56      }
    57
    58      public static void releaseAll ()
    59      {
    60          _logs.clear();
    61      }
    62  }