jvanzyl     01/10/27 19:59:18

  Modified:    src/java/org/apache/torque Torque.java
  Log:
  - the start of torque working as a separate entity. much of the logic
    will be borrowed from fulcrum, some analysis will happen and than
    the common elements will be factored out into some form of common
    component as the logic is replicated all throughout the code that
    has been separated from turbine.
  
  Revision  Changes    Path
  1.20      +42 -4     jakarta-turbine-torque/src/java/org/apache/torque/Torque.java
  
  Index: Torque.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/Torque.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Torque.java       2001/10/22 05:07:08     1.19
  +++ Torque.java       2001/10/28 02:59:18     1.20
  @@ -57,15 +57,14 @@
   import java.io.FileInputStream;
   import java.io.IOException;
   import java.util.HashMap;
  +import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.Map;
   import java.util.Properties;
  -
   import org.apache.commons.collections.ExtendedProperties;
  -
   import org.apache.log4j.Category;
   import org.apache.log4j.PropertyConfigurator;
  -
  +import org.apache.log4j.helpers.NullEnumeration;
   import org.apache.torque.adapter.DB;
   import org.apache.torque.adapter.DBFactory;
   import org.apache.torque.map.DatabaseMap;
  @@ -83,7 +82,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Magn�s ��r Torfason</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
  - * @version $Id: Torque.java,v 1.19 2001/10/22 05:07:08 dlr Exp $
  + * @version $Id: Torque.java,v 1.20 2001/10/28 02:59:18 jvanzyl Exp $
    */
   public class Torque
   {
  @@ -209,6 +208,45 @@
           configuration = c;
           DBFactory.setConfiguration(c);
       }
  +
  +    /**
  +     * Determine whether log4j has already been configured.
  +     *
  +     * @return boolean Whether log4j is configured.
  +     */
  +    protected boolean isLoggingConfigured() 
  +    {
  +        // This is a note from Ceki, taken from a message on the log4j
  +        // user list:
  +        //
  +        // Having defined categories does not necessarily mean
  +        // configuration. Remember that most categories are created
  +        // outside the configuration file. What you want to check for
  +        // is the existence of appenders. The correct procedure is to
  +        // first check for appenders in the root category and if that
  +        // returns no appenders to check in other categories.
  +        
  +        Enumeration enum = Category.getRoot().getAllAppenders();
  +             
  +        if (!(enum instanceof NullEnumeration))
  +        {
  +            return true;
  +        } 
  +        else 
  +        { 
  +            Enumeration cats =  Category.getCurrentCategories();
  +            while(cats.hasMoreElements()) 
  +            {
  +                Category c = (Category) cats.nextElement();
  +                if (!(c.getAllAppenders() instanceof NullEnumeration))
  +                {
  +                    return true;
  +                }                     
  +            }
  +        }
  +             
  +        return false;
  +    } 
   
       /**
        * Shuts down the service.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to