KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > log > LogFactory


1 /*
2  * Created on Jun 4, 2004
3  *
4  * To change the template for this generated file go to
5  * Window - Preferences - Java - Code Generation - Code and Comments
6  */

7 package org.mortbay.log;
8
9 import org.apache.commons.logging.Log;
10
11
12 /* ------------------------------------------------------------ */
13 /** Log Factory.
14  * This is a static facade over the commons logging LogFactory class and it will normally simply
15  * delegate to the a discovered instance of LogFactory. However, if the system property
16  * "org.mortbay.log.LogFactory.noDiscovery" is set to true, the a static instance of the Jetty
17  * Factory is created and this is directly delegated to, thus avoiding the commons discovery
18  * mechanism (and problems associated with it).
19  *
20  * @author gregw
21  */

22 public class LogFactory {
23     static boolean noDiscovery = Boolean.getBoolean("org.mortbay.log.LogFactory.noDiscovery");
24     static org.apache.commons.logging.LogFactory factory=noDiscovery?new Factory():org.apache.commons.logging.LogFactory.getFactory();
25     
26     public static Log getLog(Class JavaDoc logClass)
27     {
28         return factory.getInstance(logClass);
29     }
30     
31     public static Log getLog(String JavaDoc log)
32     {
33         return factory.getInstance(log);
34     }
35     
36     public static org.apache.commons.logging.LogFactory getFactory()
37     {
38         return factory;
39     }
40     
41     public static void release(ClassLoader JavaDoc loader)
42     {
43         org.apache.commons.logging.LogFactory.release(loader);
44     }
45     
46 }
47
Popular Tags