01: // ========================================================================
02: // Licensed under the Apache License, Version 2.0 (the "License");
03: // you may not use this file except in compliance with the License.
04: // You may obtain a copy of the License at
05: // http://www.apache.org/licenses/LICENSE-2.0
06: // Unless required by applicable law or agreed to in writing, software
07: // distributed under the License is distributed on an "AS IS" BASIS,
08: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
09: // 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: * LogFactory
20: *
21: * Bridges com.sun.org.apache.commons.logging.LogFactory to
22: * Jetty's log.
23: *
24: */
25: public class LogFactory {
26: private static Map _logs = new HashMap();
27:
28: public static Log getLog(Class c) {
29: Log log = (Log) _logs.get(c.getName());
30: if (log == null) {
31: log = new JettyLog(c.getName());
32: _logs.put(c.getName(), log);
33: }
34:
35: return log;
36: }
37:
38: public static Log getLog(String str) {
39: return (Log) _logs.get(str);
40: }
41:
42: public static void release(URLClassLoader cl) {
43: releaseAll();
44: }
45:
46: public static void releaseAll() {
47: _logs.clear();
48: }
49: }
|