You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by he...@apache.org on 2003/01/09 18:46:22 UTC

cvs commit: jakarta-turbine-torque/src/rttest/org/apache/torque/util CopyTest.java LargeSelectTest.java

henning     2003/01/09 09:46:22

  Modified:    .        build-legacy.xml
               notes    PoolTest.java
               src/java/org/apache/torque Torque.java
               src/java/org/apache/torque/dsfactory
                        AbstractDataSourceFactory.java
                        Jdbc2PoolDataSourceFactory.java
                        JndiDataSourceFactory.java
                        TorqueDataSourceFactory.java
               src/java/org/apache/torque/manager AbstractBaseManager.java
                        MethodResultCache.java
               src/java/org/apache/torque/oid IDBroker.java
                        SequenceIdGenerator.java
               src/java/org/apache/torque/om BaseObject.java
               src/java/org/apache/torque/pool ConnectionPool.java
               src/java/org/apache/torque/util BasePeer.java Criteria.java
                        LargeSelect.java Transaction.java
               src/rttest/org/apache/torque DataTest.java
               src/rttest/org/apache/torque/util CopyTest.java
                        LargeSelectTest.java
  Log:
  - Removed all Category references from the code and replaced with log4j
    logger as Category is deprecated and will be gone shortly according to
    the log4j javadocs.
  
  - kept the log() method in BaseObject because it is user visible but
    deprecated it and added a getLog() method which returns a Logger object
  
  The whole shebang might cry for commons-logging though.
  
  Revision  Changes    Path
  1.7       +1 -1      jakarta-turbine-torque/build-legacy.xml
  
  Index: build-legacy.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/build-legacy.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build-legacy.xml	7 Aug 2002 08:07:01 -0000	1.6
  +++ build-legacy.xml	9 Jan 2003 17:46:18 -0000	1.7
  @@ -165,7 +165,7 @@
       />
   
       <available
  -      classname="org.apache.log4j.Category"
  +      classname="org.apache.log4j.Logger"
         property="log4j.present"
         classpathref="classpath"
       />
  
  
  
  1.2       +3 -3      jakarta-turbine-torque/notes/PoolTest.java
  
  Index: PoolTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/notes/PoolTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PoolTest.java	14 Mar 2002 20:06:44 -0000	1.1
  +++ PoolTest.java	9 Jan 2003 17:46:19 -0000	1.2
  @@ -54,7 +54,7 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   
   import org.apache.torque.BaseTestCase;
   import org.apache.torque.Torque;
  @@ -94,7 +94,7 @@
   
       private static int currentThreadCount = 0;
   
  -    private static Category category;
  +    private static Logger logger = Logger.getLogger(PoolTest.class);
   
       protected PoolTest()
       {
  @@ -158,7 +158,7 @@
               }
               catch (Exception e)
               {
  -                category.error(e);
  +                logger.error(e);
                   e.printStackTrace();
               }
           }
  
  
  
  1.77      +25 -25    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.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- Torque.java	8 Jan 2003 16:43:57 -0000	1.76
  +++ Torque.java	9 Jan 2003 17:46:19 -0000	1.77
  @@ -69,7 +69,7 @@
   
   import org.apache.commons.configuration.Configuration;
   import org.apache.commons.configuration.PropertiesConfiguration;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.log4j.PropertyConfigurator;
   import org.apache.log4j.helpers.NullEnumeration;
   import org.apache.stratum.lifecycle.Configurable;
  @@ -155,10 +155,10 @@
       protected static Map managers = new HashMap();
   
       /**
  -     * The logging category.
  +     * The logging logger.
        */
  -    private static Category category
  -            = Category.getInstance(Torque.class.getName());
  +    private static Logger logger
  +            = Logger.getLogger(Torque.class);
   
       /**
        * Torque-specific configuration.
  @@ -217,7 +217,7 @@
               if (configuration != null && !configuration.isEmpty())
               {
                   /*
  -                category.warn("Torque's 'services.DatabaseService.' " +
  +                logger.warn("Torque's 'services.DatabaseService.' " +
                                 "configuration prefix has been deprecated in " +
                                 "favor of the 'torque.' prefix");
                   */
  @@ -256,7 +256,7 @@
       private static final void initAdapters(Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initAdapters");
  +        logger.debug("Starting initAdapters");
           adapterMap = new HashMap();
           Configuration c = configuration.subset("database");
           if (c != null)
  @@ -279,13 +279,13 @@
               }
               catch (Exception e)
               {
  -                category.error("", e);
  +                logger.error("", e);
                   throw new TorqueException(e);
               }
           }
           else
           {
  -            category.warn("There were no adapters in the configuration.");
  +            logger.warn("There were no adapters in the configuration.");
           }
       }
   
  @@ -298,7 +298,7 @@
       private static void initDataSourceFactories(Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initDSF");
  +        logger.debug("Starting initDSF");
           dsFactoryMap = new HashMap();
           Configuration c = configuration.subset("dsfactory");
           if (c != null)
  @@ -313,7 +313,7 @@
                       {
                           String classname = c.getString(key);
                           String handle = key.substring(0, key.indexOf('.'));
  -                        category.debug("handle: " + handle
  +                        logger.debug("handle: " + handle
                                   + " DataSourceFactory: " + classname);
                           Class dsfClass = Class.forName(classname);
                           DataSourceFactory dsf =
  @@ -325,7 +325,7 @@
               }
               catch (Exception e)
               {
  -                category.error("", e);
  +                logger.error("", e);
                   throw new TorqueException(e);
               }
           }
  @@ -348,7 +348,7 @@
           if (dsFactoryMap.get(DEFAULT_NAME) == null
               && !defaultDB.equals(DEFAULT_NAME))
           {
  -            category.debug("Adding a dummy entry for "
  +            logger.debug("Adding a dummy entry for "
                              + DEFAULT_NAME + ", mapped onto " + defaultDB);
               dsFactoryMap.put(DEFAULT_NAME, dsFactoryMap.get(defaultDB));
           }
  @@ -447,7 +447,7 @@
                   if (!managers.containsKey(managedClassKey))
                   {
                       String managerClass = configuration.getString(key);
  -                    category.info("Added Manager for Class: " + managedClassKey
  +                    logger.info("Added Manager for Class: " + managedClassKey
                                     + " -> " + managerClass);
                       try
                       {
  @@ -458,7 +458,7 @@
                           // the exception thrown here seems to disappear.
                           // At least when initialized by Turbine, should find
                           // out why, but for now make sure it is noticed.
  -                        category.error("", e);
  +                        logger.error("", e);
                           e.printStackTrace();
                           throw e;
                       }
  @@ -572,7 +572,7 @@
   
                   // We have to deal with Configuration way
                   // of dealing with "," in properties which is to
  -                // make them separate values. Log4j category
  +                // make them separate values. Log4j logger
                   // properties contain commas so we must stick them
                   // back together for log4j.
                   String[] values = getConfiguration().getStringArray(key);
  @@ -591,7 +591,7 @@
               }
   
               PropertyConfigurator.configure(p);
  -            category.info("Logging has been configured by Torque.");
  +            logger.info("Logging has been configured by Torque.");
           }
       }
   
  @@ -609,10 +609,10 @@
           // 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
  +        // first check for appenders in the root logger and if that
           // returns no appenders to check in other categories.
   
  -        Enumeration enum = Category.getRoot().getAllAppenders();
  +        Enumeration enum = Logger.getRoot().getAllAppenders();
   
           if (!(enum instanceof NullEnumeration))
           {
  @@ -620,10 +620,10 @@
           }
           else
           {
  -            Enumeration cats = Category.getCurrentCategories();
  +            Enumeration cats = Logger.getCurrentCategories();
               while (cats.hasMoreElements())
               {
  -                Category c = (Category) cats.nextElement();
  +                Logger c = (Logger) cats.nextElement();
                   if (!(c.getAllAppenders() instanceof NullEnumeration))
                   {
                       return true;
  @@ -644,7 +644,7 @@
           AbstractBaseManager m = (AbstractBaseManager) managers.get(name);
           if (m == null)
           {
  -            category.error("No configured manager for key " + name + ".");
  +            logger.error("No configured manager for key " + name + ".");
           }
           return m;
       }
  @@ -663,7 +663,7 @@
           AbstractBaseManager m = (AbstractBaseManager) managers.get(name);
           if (m == null)
           {
  -            category.debug("Added late Manager mapping for Class: "
  +            logger.debug("Added late Manager mapping for Class: "
                              + name + " -> " + defaultClassName);
   
               try
  @@ -672,7 +672,7 @@
               }
               catch (TorqueException e)
               {
  -                category.error(e.getMessage(), e);
  +                logger.error(e.getMessage(), e);
               }
   
               // Try again now that the default manager should be in the map
  @@ -994,7 +994,7 @@
               }
               catch (SQLException e)
               {
  -                category.error("Error occured while closing connection.", e);
  +                logger.error("Error occured while closing connection.", e);
               }
           }
       }
  
  
  
  1.8       +12 -12    jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java
  
  Index: AbstractDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractDataSourceFactory.java	9 Jan 2003 15:39:35 -0000	1.7
  +++ AbstractDataSourceFactory.java	9 Jan 2003 17:46:19 -0000	1.8
  @@ -55,7 +55,7 @@
    */
   
   import java.util.Iterator;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.commons.configuration.Configuration;
   import org.apache.commons.beanutils.ConvertUtils;
   import org.apache.commons.beanutils.PropertyUtils;
  @@ -85,10 +85,10 @@
       public static final String DEFAULT_CONNECTION_KEY = "defaults.connection";
   
       /**
  -     * The logging category.
  +     * The logging logger.
        */
  -    private static Category category =
  -        Category.getInstance(AbstractDataSourceFactory.class);
  +    private static Logger logger =
  +        Logger.getLogger(AbstractDataSourceFactory.class);
   
       /**
        * Encapsulates setting configuration properties on 
  @@ -125,9 +125,9 @@
                       PropertyUtils
                           .setMappedProperty(ds, property, subProp, value);
   
  -                    if (category.isDebugEnabled())
  +                    if (logger.isDebugEnabled())
                       {
  -                        category.debug("setMappedProperty(" 
  +                        logger.debug("setMappedProperty(" 
                                          + ds + ", "
                                          + property + ", "
                                          + subProp + ", "
  @@ -144,9 +144,9 @@
                       ConvertUtils.convert(c.getString(property), propertyType);
                   PropertyUtils.setSimpleProperty(ds, property, value);
   
  -                if (category.isDebugEnabled())
  +                if (logger.isDebugEnabled())
                   {
  -                    category.debug("setSimpleProperty(" 
  +                    logger.debug("setSimpleProperty(" 
                                      + ds + ", "
                                      + property + ", "
                                      + value 
  @@ -156,7 +156,7 @@
           }
           catch (Exception e)
           {
  -            category.error(
  +            logger.error(
                   "Property: "
                   + property
                   + " value: "
  @@ -179,7 +179,7 @@
       protected void applyConfiguration(Configuration c, Object o)
           throws TorqueException
       {
  -        category.debug("applyConfiguration(" + c + ", " + o + ")");
  +        logger.debug("applyConfiguration(" + c + ", " + o + ")");
           
           if(c != null)
           {
  @@ -193,7 +193,7 @@
               }
               catch (Exception e)
               {
  -                category.error(e);
  +                logger.error(e);
                   throw new TorqueException(e);
               }
           }
  
  
  
  1.7       +6 -6      jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/Jdbc2PoolDataSourceFactory.java
  
  Index: Jdbc2PoolDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/Jdbc2PoolDataSourceFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Jdbc2PoolDataSourceFactory.java	9 Jan 2003 15:39:35 -0000	1.6
  +++ Jdbc2PoolDataSourceFactory.java	9 Jan 2003 17:46:20 -0000	1.7
  @@ -62,7 +62,7 @@
   import org.apache.commons.configuration.Configuration;
   import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
   import org.apache.commons.dbcp.jdbc2pool.Jdbc2PoolDataSource;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   
  @@ -79,8 +79,8 @@
   {
   
       /** The log. */
  -    private static Category category =
  -        Category.getInstance(Jdbc2PoolDataSourceFactory.class);
  +    private static Logger logger =
  +        Logger.getLogger(Jdbc2PoolDataSourceFactory.class);
   
       /** The wrapped <code>DataSource</code>. */
       private DataSource ds;
  @@ -121,7 +121,7 @@
       private ConnectionPoolDataSource initCPDS(Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initCPDS");
  +        logger.debug("Starting initCPDS");
           ConnectionPoolDataSource cpds = new DriverAdapterCPDS();
           Configuration c = null;
   
  @@ -143,7 +143,7 @@
       private Jdbc2PoolDataSource initJdbc2Pool(Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initTorqueClassic");
  +        logger.debug("Starting initJdbc2Pool");
           Jdbc2PoolDataSource ds = new Jdbc2PoolDataSource();
           Configuration c = null;
   
  
  
  
  1.5       +18 -18    jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java
  
  Index: JndiDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JndiDataSourceFactory.java	27 Nov 2002 11:43:15 -0000	1.4
  +++ JndiDataSourceFactory.java	9 Jan 2003 17:46:20 -0000	1.5
  @@ -66,7 +66,7 @@
   import javax.sql.DataSource;
   
   import org.apache.commons.configuration.Configuration;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.TorqueException;
   
   /**
  @@ -83,8 +83,8 @@
   {
   
       /** The log. */
  -    private static Category category =
  -        Category.getInstance(JndiDataSourceFactory.class);
  +    private static Logger logger =
  +        Logger.getLogger(JndiDataSourceFactory.class);
   
       /** The path to get the resource from. */
       private String path;
  @@ -132,7 +132,7 @@
        */
       private void initJNDI(Configuration configuration) throws TorqueException
       {
  -        category.debug("Starting initJNDI");
  +        logger.debug("Starting initJNDI");
           Hashtable env = null;
           Configuration c = configuration.subset("jndi");
           if (c == null)
  @@ -150,7 +150,7 @@
                   if (key.equals("path"))
                   {
                       path = c.getString(key);
  -                    category.debug("JNDI path: " + path);
  +                    logger.debug("JNDI path: " + path);
                   }
                   else
                   {
  @@ -160,7 +160,7 @@
                       }
                       String value = c.getString(key);
                       env.put(key, value);
  -                    category.debug("Set jndi property: " + key + "=" + value);
  +                    logger.debug("Set jndi property: " + key + "=" + value);
                   }
               }
               if (env == null)
  @@ -171,12 +171,12 @@
               {
                   ctx = new InitialContext(env);
               }
  -            category.debug("Created new InitialContext");
  +            logger.debug("Created new InitialContext");
               debugCtx(ctx);
           }
           catch (Exception e)
           {
  -            category.error("", e);
  +            logger.error("", e);
               throw new TorqueException(e);
           }
       }
  @@ -190,7 +190,7 @@
       private void initDataSource(Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initDataSources");
  +        logger.debug("Starting initDataSources");
           Configuration c = configuration.subset("datasource");
           try
           {
  @@ -204,14 +204,14 @@
                       if (key.equals("classname"))
                       {
                           String classname = c.getString(key);
  -                        category.debug("Datasource class: " + classname);
  +                        logger.debug("Datasource class: " + classname);
   
                           Class dsClass = Class.forName(classname);
                           ds = dsClass.newInstance();
                       }
                       else
                       {
  -                        category.debug("Setting datasource property: " + key);
  +                        logger.debug("Setting datasource property: " + key);
                           setProperty(key, c, ds);
                       }
                   }
  @@ -221,7 +221,7 @@
           }
           catch (Exception e)
           {
  -            category.error("", e);
  +            logger.error("", e);
               throw new TorqueException(e);
           }
       }
  @@ -233,16 +233,16 @@
        */
       private void debugCtx(Context ctx) throws NamingException
       {
  -        category.debug("InitialContext -------------------------------");
  +        logger.debug("InitialContext -------------------------------");
           Map env = ctx.getEnvironment();
           Iterator qw = env.keySet().iterator();
  -        category.debug("Environment properties:" + env.size());
  +        logger.debug("Environment properties:" + env.size());
           while (qw.hasNext())
           {
               Object prop = qw.next();
  -            category.debug("    " + prop + ": " + env.get(prop));
  +            logger.debug("    " + prop + ": " + env.get(prop));
           }
  -        category.debug("----------------------------------------------");
  +        logger.debug("----------------------------------------------");
       }
   
       /**
  @@ -272,7 +272,7 @@
                   try
                   {
                       ctx.createSubcontext(subctx);
  -                    category.debug("Added sub context: " + subctx);
  +                    logger.debug("Added sub context: " + subctx);
                   }
                   catch (NameAlreadyBoundException nabe)
                   {
  
  
  
  1.9       +6 -6      jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/TorqueDataSourceFactory.java
  
  Index: TorqueDataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/dsfactory/TorqueDataSourceFactory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TorqueDataSourceFactory.java	9 Jan 2003 15:39:35 -0000	1.8
  +++ TorqueDataSourceFactory.java	9 Jan 2003 17:46:20 -0000	1.9
  @@ -61,7 +61,7 @@
   
   import org.apache.commons.configuration.Configuration;
   import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   import org.apache.torque.pool.TorqueClassicDataSource;
  @@ -79,8 +79,8 @@
   {
   
       /** The log. */
  -    private static Category category =
  -        Category.getInstance(TorqueDataSourceFactory.class);
  +    private static Logger logger =
  +        Logger.getLogger(TorqueDataSourceFactory.class);
   
       /** The wrapped <code>DataSource</code>. */
       private DataSource ds;
  @@ -121,7 +121,7 @@
       protected ConnectionPoolDataSource initCPDS(Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initCPDS");
  +        logger.debug("Starting initCPDS");
           ConnectionPoolDataSource cpds = new DriverAdapterCPDS();
           Configuration c = null;
   
  @@ -144,7 +144,7 @@
           Configuration configuration)
           throws TorqueException
       {
  -        category.debug("Starting initTorqueClassic");
  +        logger.debug("Starting initTorqueClassic");
           TorqueClassicDataSource ds = new TorqueClassicDataSource();
   
           Configuration c = null;
  
  
  
  1.12      +6 -6      jakarta-turbine-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java
  
  Index: AbstractBaseManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractBaseManager.java	29 Nov 2002 13:16:05 -0000	1.11
  +++ AbstractBaseManager.java	9 Jan 2003 17:46:20 -0000	1.12
  @@ -73,7 +73,7 @@
   import org.apache.torque.TorqueException;
   import org.apache.torque.om.ObjectKey;
   import org.apache.torque.om.Persistent;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   
   /**
    * This class contains common functionality of a Manager for
  @@ -86,8 +86,8 @@
       implements Serializable
   {
       /** the log */
  -    protected static final Category category =
  -        Category.getInstance(AbstractBaseManager.class.getName());
  +    protected static final Logger logger =
  +        Logger.getLogger(AbstractBaseManager.class);
   
       /** used to cache the om objects. cache is set by the region property */
       protected transient GroupCacheAccess cache;
  @@ -466,7 +466,7 @@
           }
           if (cache == null)
           {
  -            category.info("Cache could not be initialized for region: " + v);
  +            logger.info("Cache could not be initialized for region: " + v);
           }
       }
   
  @@ -611,7 +611,7 @@
           }
           catch (Exception e)
           {
  -            category.error("Cache could not be initialized for region: "
  +            logger.error("Cache could not be initialized for region: "
                              + region + "after deserialization");
           }
       }
  
  
  
  1.14      +6 -6      jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodResultCache.java
  
  Index: MethodResultCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodResultCache.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- MethodResultCache.java	29 Nov 2002 13:16:05 -0000	1.13
  +++ MethodResultCache.java	9 Jan 2003 17:46:20 -0000	1.14
  @@ -57,11 +57,11 @@
   import java.util.Map;
   import java.util.HashMap;
   import java.io.Serializable;
  -import org.apache.log4j.Category;
   import org.apache.jcs.access.GroupCacheAccess;
   import org.apache.jcs.access.exception.CacheException;
   import org.apache.commons.pool.ObjectPool;
   import org.apache.commons.pool.impl.StackObjectPool;
  +import org.apache.log4j.Logger;
   
   import org.apache.torque.TorqueException;
   
  @@ -73,10 +73,6 @@
    */
   public class MethodResultCache
   {
  -    /** the log */
  -    private static final Category log =
  -        Category.getInstance("org.apache.torque");
  -
       private static final String keyClassName =
           "org.apache.torque.manager.MethodCacheKey";
       private ObjectPool pool;
  @@ -84,6 +80,10 @@
       private boolean lockCache;
       private int inGet;
       private Map groups;
  +
  +    /** Logging */
  +    private static Logger log =
  +        Logger.getLogger(MethodResultCache.class);
   
       public MethodResultCache(GroupCacheAccess cache)
           throws TorqueException
  
  
  
  1.22      +112 -112  jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- IDBroker.java	8 Jan 2003 16:43:58 -0000	1.21
  +++ IDBroker.java	9 Jan 2003 17:46:20 -0000	1.22
  @@ -64,7 +64,7 @@
   import java.util.List;
   
   import org.apache.commons.configuration.Configuration;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   import org.apache.torque.map.DatabaseMap;
  @@ -202,10 +202,10 @@
           "idbroker.usenewconnection";
   
       /**
  -     * Category used for logging.
  +     * Logger used for logging.
        */
  -    private Category category =
  -        Category.getInstance(IDBroker.class.getName());
  +    private Logger logger =
  +        Logger.getLogger(IDBroker.class);
   
       /**
        * Creates an IDBroker for the ID table.
  @@ -256,13 +256,13 @@
           }
           if (!transactionsSupported)
           {
  -            category.warn("IDBroker is being used with db '" + dbName
  -                    + "', which does not support transactions. IDBroker "
  -                    + "attempts to use transactions to limit the possibility "
  -                    + "of duplicate key generation.  Without transactions, "
  -                    + "duplicate key generation is possible if multiple JVMs "
  -                    + "are used or other means are used to write to the "
  -                    + "database.");
  +            logger.warn("IDBroker is being used with db '" + dbName
  +                        + "', which does not support transactions. IDBroker "
  +                        + "attempts to use transactions to limit the possibility "
  +                        + "of duplicate key generation.  Without transactions, "
  +                        + "duplicate key generation is possible if multiple JVMs "
  +                        + "are used or other means are used to write to the "
  +                        + "database.");
           }
       }
   
  @@ -284,7 +284,7 @@
        * @exception Exception Database error.
        */
       public int getIdAsInt(Connection connection, Object tableName)
  -            throws Exception
  +        throws Exception
       {
           return getIdAsBigDecimal(connection, tableName).intValue();
       }
  @@ -430,11 +430,11 @@
           {
               if (availableIds == null)
               {
  -                category.debug("Forced id retrieval - no available list");
  +                logger.debug("Forced id retrieval - no available list");
               }
               else
               {
  -                category.debug("Forced id retrieval - " + availableIds.size());
  +                logger.debug("Forced id retrieval - " + availableIds.size());
               }
               storeIDs(tableName, true, connection);
               availableIds = (List) ids.get(tableName);
  @@ -448,14 +448,14 @@
           // We assume that availableIds will always come from the ids
           // Hashtable and would therefore always be the same object for
           // a specific table.
  -//        synchronized (availableIds)
  -//        {
  -            for (int i = size - 1; i >= 0; i--)
  -            {
  -                results[i] = (BigDecimal) availableIds.get(i);
  -                availableIds.remove(i);
  -            }
  -//        }
  +        //        synchronized (availableIds)
  +        //        {
  +        for (int i = size - 1; i >= 0; i--)
  +        {
  +            results[i] = (BigDecimal) availableIds.get(i);
  +            availableIds.remove(i);
  +        }
  +        //        }
   
           return results;
       }
  @@ -500,7 +500,7 @@
               }
               catch (Exception e)
               {
  -                category.error("Release of connection failed.", e);
  +                logger.error("Release of connection failed.", e);
               }
           }
           return exists;
  @@ -513,7 +513,7 @@
        */
       public void run()
       {
  -        category.debug("IDBroker thread was started.");
  +        logger.debug("IDBroker thread was started.");
   
           Thread thisThread = Thread.currentThread();
           while (houseKeeperThread == thisThread)
  @@ -527,13 +527,13 @@
                   // ignored
               }
   
  -            // category.info("IDBroker thread checking for more keys.");
  +            // logger.info("IDBroker thread checking for more keys.");
               Iterator it = ids.keySet().iterator();
               while (it.hasNext())
               {
                   String tableName = (String) it.next();
  -                category.debug("IDBroker thread checking for more keys "
  -                        + "on table: " + tableName);
  +                logger.debug("IDBroker thread checking for more keys "
  +                             + "on table: " + tableName);
                   List availableIds = (List) ids.get(tableName);
                   int quantity = getQuantity(tableName, null).intValue();
                   if (quantity > availableIds.size())
  @@ -544,18 +544,18 @@
                           // want the quantity to be adjusted for thread
                           // calls.
                           storeIDs(tableName, false, null);
  -                        category.debug("Retrieved more ids for table: "
  -                                + tableName);
  +                        logger.debug("Retrieved more ids for table: "
  +                                     + tableName);
                       }
                       catch (Exception exc)
                       {
  -                        category.error("There was a problem getting new IDs "
  -                                + "for table: " + tableName, exc);
  +                        logger.error("There was a problem getting new IDs "
  +                                     + "for table: " + tableName, exc);
                       }
                   }
               }
           }
  -        category.debug("IDBroker thread finished.");
  +        logger.debug("IDBroker thread finished.");
       }
   
       /**
  @@ -584,7 +584,7 @@
           // Check if quantity changing is switched on.
           // If prefetch is turned off, changing quantity does not make sense
           if (!configuration.getBoolean(DB_IDBROKER_CLEVERQUANTITY, true)
  -                || !configuration.getBoolean(DB_IDBROKER_PREFETCH, true))
  +            || !configuration.getBoolean(DB_IDBROKER_PREFETCH, true))
           {
               return;
           }
  @@ -600,14 +600,14 @@
               int timeLapse = (int) (nowLong - thenLong);
               if (timeLapse < sleepPeriod && timeLapse > 0)
               {
  -                category.debug("Unscheduled retrieval of more ids for table: "
  -                        + tableName);
  +                logger.debug("Unscheduled retrieval of more ids for table: "
  +                             + tableName);
                   // Increase quantity, so that hopefully this does not
                   // happen again.
                   float rate = getQuantity(tableName, null).floatValue()
  -                        / (float) timeLapse;
  +                    / (float) timeLapse;
                   quantityStore.put(tableName, new BigDecimal(
  -                        Math.ceil(sleepPeriod * rate * safetyMargin)));
  +                                      Math.ceil(sleepPeriod * rate * safetyMargin)));
               }
           }
           lastQueryTime.put(tableName, now);
  @@ -635,62 +635,62 @@
   
           // Block on the table.  Multiple tables are allowed to ask for
           // ids simultaneously.
  -//        synchronized(tMap)  see comment in the getNextIds method
  -//        {
  -            if (adjustQuantity)
  -            {
  -                checkTiming(tableName);
  -            }
  +        //        synchronized(tMap)  see comment in the getNextIds method
  +        //        {
  +        if (adjustQuantity)
  +        {
  +            checkTiming(tableName);
  +        }
   
  -            try
  +        try
  +        {
  +            if (connection == null || configuration
  +                .getBoolean(DB_IDBROKER_USENEWCONNECTION, true))
               {
  -                if (connection == null || configuration
  -                    .getBoolean(DB_IDBROKER_USENEWCONNECTION, true))
  -                {
  -                    String databaseName = dbMap.getName();
  -                    connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  -                }
  +                String databaseName = dbMap.getName();
  +                connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  +            }
   
  -                // Write the current value of quantity of keys to grab
  -                // to the database, primarily to obtain a write lock
  -                // on the table/row, but this value will also be used
  -                // as the starting value when an IDBroker is
  -                // instantiated.
  -                quantity = getQuantity(tableName, connection);
  -                updateQuantity(connection, tableName, quantity);
  -
  -                // Read the next starting ID from the ID_TABLE.
  -                BigDecimal[] results = selectRow(connection, tableName);
  -                nextId = results[0]; // NEXT_ID column
  -
  -                // Update the row based on the quantity in the
  -                // ID_TABLE.
  -                BigDecimal newNextId = nextId.add(quantity);
  -                updateNextId(connection, tableName, newNextId.toString());
  +            // Write the current value of quantity of keys to grab
  +            // to the database, primarily to obtain a write lock
  +            // on the table/row, but this value will also be used
  +            // as the starting value when an IDBroker is
  +            // instantiated.
  +            quantity = getQuantity(tableName, connection);
  +            updateQuantity(connection, tableName, quantity);
  +
  +            // Read the next starting ID from the ID_TABLE.
  +            BigDecimal[] results = selectRow(connection, tableName);
  +            nextId = results[0]; // NEXT_ID column
  +
  +            // Update the row based on the quantity in the
  +            // ID_TABLE.
  +            BigDecimal newNextId = nextId.add(quantity);
  +            updateNextId(connection, tableName, newNextId.toString());
   
  -                Transaction.commit(connection);
  -            }
  -            catch (Exception e)
  -            {
  -                Transaction.rollback(connection);
  -                throw e;
  -            }
  +            Transaction.commit(connection);
  +        }
  +        catch (Exception e)
  +        {
  +            Transaction.rollback(connection);
  +            throw e;
  +        }
   
  -            List availableIds = (List) ids.get(tableName);
  -            if (availableIds == null)
  -            {
  -                availableIds = new ArrayList();
  -                ids.put(tableName, availableIds);
  -            }
  +        List availableIds = (List) ids.get(tableName);
  +        if (availableIds == null)
  +        {
  +            availableIds = new ArrayList();
  +            ids.put(tableName, availableIds);
  +        }
   
  -            // Create the ids and store them in the list of available ids.
  -            int numId = quantity.intValue();
  -            for (int i = 0; i < numId; i++)
  -            {
  -                availableIds.add(nextId);
  -                nextId = nextId.add(ONE);
  -            }
  -//        }
  +        // Create the ids and store them in the list of available ids.
  +        int numId = quantity.intValue();
  +        for (int i = 0; i < numId; i++)
  +        {
  +            availableIds.add(nextId);
  +            nextId = nextId.add(ONE);
  +        }
  +        //        }
       }
   
       /**
  @@ -754,7 +754,7 @@
                   }
                   catch (Exception e)
                   {
  -                    category.error("Release of connection failed.", e);
  +                    logger.error("Release of connection failed.", e);
                   }
               }
           }
  @@ -771,14 +771,14 @@
        * @exception Exception a generic exception.
        */
       private BigDecimal[] selectRow(Connection con, String tableName)
  -            throws Exception
  +        throws Exception
       {
           StringBuffer stmt = new StringBuffer();
           stmt.append("SELECT " + NEXT_ID + ", " + QUANTITY)
  -                .append(" FROM " + ID_TABLE)
  -                .append(" WHERE TABLE_NAME = '")
  -                .append(tableName)
  -                .append('\'');
  +            .append(" FROM " + ID_TABLE)
  +            .append(" WHERE TABLE_NAME = '")
  +            .append(tableName)
  +            .append('\'');
   
           Statement statement = null;
   
  @@ -799,7 +799,7 @@
               else
               {
                   throw new TorqueException("The table " + tableName +
  -                    " does not have a proper entry in the " + ID_TABLE);
  +                                          " does not have a proper entry in the " + ID_TABLE);
               }
           }
           finally
  @@ -823,22 +823,22 @@
        * @exception Exception Database error.
        */
       private void updateNextId(Connection con, String tableName, String id)
  -            throws Exception
  +        throws Exception
       {
   
   
           StringBuffer stmt = new StringBuffer(id.length()
  -                + tableName.length() + 50);
  +                                             + tableName.length() + 50);
           stmt.append("UPDATE " + ID_TABLE)
  -                .append(" SET NEXT_ID = ")
  -                .append(id)
  -                .append(" WHERE TABLE_NAME = '")
  -                .append(tableName)
  -                .append('\'');
  +            .append(" SET NEXT_ID = ")
  +            .append(id)
  +            .append(" WHERE TABLE_NAME = '")
  +            .append(tableName)
  +            .append('\'');
   
           Statement statement = null;
   
  -        category.debug("updateNextId: " + stmt.toString());
  +        logger.debug("updateNextId: " + stmt.toString());
   
           try
           {
  @@ -864,21 +864,21 @@
        * @exception Exception Database error.
        */
       private void updateQuantity(Connection con, String tableName,
  -            BigDecimal quantity)
  -            throws Exception
  +                                BigDecimal quantity)
  +        throws Exception
       {
           StringBuffer stmt = new StringBuffer(quantity.toString().length()
  -                + tableName.length() + 50);
  +                                             + tableName.length() + 50);
           stmt.append("UPDATE " + ID_TABLE)
  -                .append(" SET QUANTITY = ")
  -                .append(quantity)
  -                .append(" WHERE TABLE_NAME = '")
  -                .append(tableName)
  -                .append('\'');
  +            .append(" SET QUANTITY = ")
  +            .append(quantity)
  +            .append(" WHERE TABLE_NAME = '")
  +            .append(tableName)
  +            .append('\'');
   
           Statement statement = null;
   
  -        category.debug("updateQuantity: " + stmt.toString());
  +        logger.debug("updateQuantity: " + stmt.toString());
   
           try
           {
  
  
  
  1.8       +4 -4      jakarta-turbine-torque/src/java/org/apache/torque/oid/SequenceIdGenerator.java
  
  Index: SequenceIdGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/oid/SequenceIdGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SequenceIdGenerator.java	26 Nov 2002 23:46:56 -0000	1.7
  +++ SequenceIdGenerator.java	9 Jan 2003 17:46:20 -0000	1.8
  @@ -57,7 +57,7 @@
   import java.math.BigDecimal;
   import java.sql.Connection;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.adapter.DB;
   
   import com.workingdogs.village.QueryDataSet;
  @@ -74,7 +74,7 @@
   public class SequenceIdGenerator implements IdGenerator
   {
       /** The log. */
  -    private static Category category = Category.getInstance(
  +    private static Logger logger = Logger.getLogger(
               SequenceIdGenerator.class);
   
       /** the adapter that knows the correct sql syntax */
  @@ -189,7 +189,7 @@
           throws Exception
       {
           String idSql = dbAdapter.getIDMethodSQL(keyInfo);
  -        category.debug(idSql);
  +        logger.debug(idSql);
   
           // Execute the query.
           QueryDataSet qds = new QueryDataSet(connection, idSql);
  
  
  
  1.16      +23 -1     jakarta-turbine-torque/src/java/org/apache/torque/om/BaseObject.java
  
  Index: BaseObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/BaseObject.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BaseObject.java	11 Dec 2002 14:00:20 -0000	1.15
  +++ BaseObject.java	9 Jan 2003 17:46:20 -0000	1.16
  @@ -56,6 +56,7 @@
   
   import java.io.Serializable;
   import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import java.sql.Connection;
   
   /**
  @@ -104,6 +105,12 @@
        */
       private transient Category log = null;
   
  +
  +    /**
  +     * Cache the logger to avoid looking it up every time its needed.
  +     */
  +    private transient Logger logger = null;
  +
       /**
        * getter for the object primaryKey.
        *
  @@ -308,6 +315,7 @@
        * gets a log4j Category based on class name.
        *
        * @return a <code>Category</code> to write log to.
  +     * @deprecated Use getLog()
        */
       protected Category log()
       {
  @@ -316,6 +324,20 @@
               log = Category.getInstance(getClass().getName());
           }
           return log;
  +    }
  +
  +    /**
  +     * gets a log4j Logger based on class name.
  +     *
  +     * @return a <code>Logger</code> to write log to.
  +     */
  +    protected Logger getLog()
  +    {
  +        if (logger == null)
  +        {
  +            logger = Logger.getLogger(getClass());
  +        }
  +        return logger;
       }
   
       /**
  
  
  
  1.23      +8 -8      jakarta-turbine-torque/src/java/org/apache/torque/pool/ConnectionPool.java
  
  Index: ConnectionPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/pool/ConnectionPool.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ConnectionPool.java	9 Jan 2003 15:00:34 -0000	1.22
  +++ ConnectionPool.java	9 Jan 2003 17:46:21 -0000	1.23
  @@ -64,7 +64,7 @@
   import javax.sql.ConnectionPoolDataSource;
   import javax.sql.PooledConnection;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   
   /**
    * This class implements a simple connection pooling scheme.  Multiple
  @@ -136,10 +136,10 @@
       private int waitCount = 0;
   
       /**
  -     * The logging category.
  +     * The logging logger.
        */
  -    private static Category category
  -        = Category.getInstance(ConnectionPool.class.getName());
  +    private static Logger logger
  +        = Logger.getLogger(ConnectionPool.class);
   
       /** Interval (in seconds) that the monitor thread reports the pool state */
       private int logInterval = 0;
  @@ -201,7 +201,7 @@
   
           if (logInterval > 0)
           {
  -            category.debug("Starting Pool Monitor Thread with Log Interval " 
  +            logger.debug("Starting Pool Monitor Thread with Log Interval " 
                              + logInterval + " Milliseconds");
   
               // Create monitor thread
  @@ -600,7 +600,7 @@
           }
           catch (Exception e)
           {
  -            category.error("Error occurred trying to close a "
  +            logger.error("Error occurred trying to close a "
                              + "PooledConnection.", e);
           }
           finally
  @@ -638,7 +638,7 @@
                   buf.append(" avail: ").append(getNbrAvailable());
                   buf.append(" in use: ").append(getNbrCheckedOut());
                   buf.append(" total: ").append(getTotalCount());
  -                category.info(buf.toString());
  +                logger.info(buf.toString());
   
                   // Wait for a bit.
                   try
  
  
  
  1.59      +12 -12    jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java
  
  Index: BasePeer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- BasePeer.java	8 Jan 2003 16:43:59 -0000	1.58
  +++ BasePeer.java	9 Jan 2003 17:46:21 -0000	1.59
  @@ -71,7 +71,7 @@
   import java.util.List;
   
   import org.apache.commons.collections.StringStack;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   import org.apache.torque.adapter.DB;
  @@ -129,7 +129,7 @@
       private static Hashtable mapBuilders = new Hashtable(5);
   
       /** the log */
  -    protected static Category category = Category.getInstance(BasePeer.class);
  +    protected static Logger logger = Logger.getLogger(BasePeer.class);
   
       /**
        * Converts a hashtable to a byte array for storage/serialization.
  @@ -248,7 +248,7 @@
           }
           catch (Exception e)
           {
  -            category.error(e);
  +            logger.error(e);
               throw new Error(
                   "Error in BasePeer.initTableSchema("
                       + tableName
  @@ -282,7 +282,7 @@
           }
           catch (Exception e)
           {
  -            category.error(e);
  +            logger.error(e);
               throw new Error(
                   "Error in BasePeer.initTableColumns(): " + e.getMessage());
           }
  @@ -548,7 +548,7 @@
                   tds = new TableDataSet(con, tables.get(i), kd);
                   String sqlSnippet = whereClause.toString(" AND ");
   
  -                category.debug("BasePeer.doDelete: whereClause=" + sqlSnippet);
  +                logger.debug("BasePeer.doDelete: whereClause=" + sqlSnippet);
   
                   tds.where(sqlSnippet);
                   tds.fetchRecords();
  @@ -1002,7 +1002,7 @@
               sql = query.toString();
           }
   
  -        category.debug(sql);
  +        logger.debug(sql);
           return sql;
       }
   
  @@ -1549,7 +1549,7 @@
               // execute the query
               long startTime = System.currentTimeMillis();
               qds = new QueryDataSet(con, queryString);
  -            category.debug(
  +            logger.debug(
                   "Elapsed time="
                       + (System.currentTimeMillis() - startTime)
                       + " ms");
  @@ -1938,7 +1938,7 @@
                   // Get affected records.
                   tds = new TableDataSet(con, tables.get(i), kd);
                   String sqlSnippet = whereClause.toString(" AND ");
  -                category.debug("BasePeer.doUpdate: whereClause=" + sqlSnippet);
  +                logger.debug("BasePeer.doUpdate: whereClause=" + sqlSnippet);
                   tds.where(sqlSnippet);
                   tds.fetchRecords();
   
  @@ -2157,14 +2157,14 @@
               // return null.
               String message =
                   "BasePeer.MapBuilder failed trying to instantiate: " + name;
  -            if (category == null)
  +            if (logger == null)
               {
                   System.out.println(message);
                   e.printStackTrace();
               }
               else
               {
  -                category.error(message, e);
  +                logger.error(message, e);
               }
           }
           return null;
  @@ -2631,7 +2631,7 @@
               sql = query.toString();
           }
   
  -        category.debug(sql);
  +        logger.debug(sql);
           queryString.append(sql);
       }
   
  
  
  
  1.37      +6 -6      jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java
  
  Index: Criteria.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Criteria.java	12 Dec 2002 14:53:28 -0000	1.36
  +++ Criteria.java	9 Jan 2003 17:46:21 -0000	1.37
  @@ -66,7 +66,7 @@
   import java.util.List;
   import java.util.Map;
   import org.apache.commons.collections.StringStack;
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.Torque;
   import org.apache.torque.adapter.DB;
   import org.apache.torque.om.DateKey;
  @@ -190,9 +190,9 @@
   
       private boolean useTransaction = false;
   
  -    /** Log4j category used for logging. */
  -    private static Category category
  -            = Category.getInstance(Criteria.class.getName());
  +    /** Log4j logger used for logging. */
  +    private static Logger logger
  +            = Logger.getLogger(Criteria.class);
   
       /**
        * Creates a new instance with the default capacity.
  @@ -3175,7 +3175,7 @@
                   {
                       // we are only doing this to allow easier debugging, so
                       // no need to throw up the exception, just make note of it.
  -                    category.error(
  +                    logger.error(
                          "Could not get a DB adapter, so sql may be wrong");
                   }
               }
  
  
  
  1.9       +7 -6      jakarta-turbine-torque/src/java/org/apache/torque/util/LargeSelect.java
  
  Index: LargeSelect.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/LargeSelect.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LargeSelect.java	27 Nov 2002 11:31:00 -0000	1.8
  +++ LargeSelect.java	9 Jan 2003 17:46:21 -0000	1.9
  @@ -62,7 +62,8 @@
   import java.util.Hashtable;
   import java.lang.reflect.Method;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
  +
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   
  @@ -168,10 +169,6 @@
    */
   public class LargeSelect implements Runnable
   {
  -
  -    /** The log. */
  -    private static final Category log = Category.getInstance(LargeSelect.class);
  -
       /** The number of records that a page consists of.  */
       private int pageSize;
       /** The maximum number of records to maintain in memory. */
  @@ -259,6 +256,10 @@
   
       /** A place to store search parameters that relate to this query. */
       private Hashtable params = null;
  +
  +    /** Logging */
  +    private static Logger log =
  +        Logger.getLogger(LargeSelect.class);
   
       /**
        * Creates a LargeSelect whose results are returned as a <code>List</code>
  
  
  
  1.6       +15 -15    jakarta-turbine-torque/src/java/org/apache/torque/util/Transaction.java
  
  Index: Transaction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/Transaction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Transaction.java	8 Jan 2003 11:11:29 -0000	1.5
  +++ Transaction.java	9 Jan 2003 17:46:21 -0000	1.6
  @@ -57,7 +57,7 @@
   import java.sql.Connection;
   import java.sql.SQLException;
   
  -import org.apache.log4j.Category;
  +import org.apache.log4j.Logger;
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
   
  @@ -81,7 +81,7 @@
   {
   
       /** The log. */
  -    private static Category category = Category.getInstance(Transaction.class);
  +    private static Logger logger = Logger.getLogger(Transaction.class);
   
       /**
        * Begin a transaction.  This method will fallback gracefully to
  @@ -108,7 +108,7 @@
        * @throws TorqueException
        */
       public static Connection beginOptional(String dbName,
  -        boolean useTransaction)
  +                                           boolean useTransaction)
           throws TorqueException
       {
           Connection con = Torque.getConnection(dbName);
  @@ -139,9 +139,9 @@
           if (con == null)
           {
               throw new NullPointerException("Connection object was null. "
  -                    + "This could be due to a misconfiguration of the "
  -                    + "DataSourceFactory. Check the logs and Torque.properties "
  -                    + "to better determine the cause.");
  +                                           + "This could be due to a misconfiguration of the "
  +                                           + "DataSourceFactory. Check the logs and Torque.properties "
  +                                           + "to better determine the cause.");
           }
   
           try
  @@ -176,10 +176,10 @@
       {
           if (con == null)
           {
  -            category.error("Connection object was null. "
  -                    + "This could be due to a misconfiguration of the "
  -                    + "DataSourceFactory. Check the logs and Torque.properties "
  -                    + "to better determine the cause.");
  +            logger.error("Connection object was null. "
  +                         + "This could be due to a misconfiguration of the "
  +                         + "DataSourceFactory. Check the logs and Torque.properties "
  +                         + "to better determine the cause.");
           }
           else
           {
  @@ -194,9 +194,9 @@
               }
               catch (SQLException e)
               {
  -                category.error("An attempt was made to rollback a transaction "
  -                               + "but the database did not allow the operation to be "
  -                               + "rolled back.", e);
  +                logger.error("An attempt was made to rollback a transaction "
  +                             + "but the database did not allow the operation to be "
  +                             + "rolled back.", e);
                   throw new TorqueException(e);
               }
               finally
  @@ -220,7 +220,7 @@
           }
           catch (TorqueException e)
           {
  -            category.error("An error occured during rollback.", e);
  +            logger.error("An error occured during rollback.", e);
           }
       }
   }
  
  
  
  1.5       +1 -2      jakarta-turbine-torque/src/rttest/org/apache/torque/DataTest.java
  
  Index: DataTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/rttest/org/apache/torque/DataTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DataTest.java	9 Dec 2002 21:24:33 -0000	1.4
  +++ DataTest.java	9 Jan 2003 17:46:22 -0000	1.5
  @@ -58,7 +58,6 @@
   import java.util.HashMap;
   import java.util.List;
   import java.util.Iterator;
  -import org.apache.log4j.Category;
   import org.apache.torque.BaseTestCase;
   import org.apache.torque.test.Author;
   import org.apache.torque.test.Book;
  
  
  
  1.2       +0 -1      jakarta-turbine-torque/src/rttest/org/apache/torque/util/CopyTest.java
  
  Index: CopyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/rttest/org/apache/torque/util/CopyTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CopyTest.java	20 Dec 2002 17:20:52 -0000	1.1
  +++ CopyTest.java	9 Jan 2003 17:46:22 -0000	1.2
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.log4j.Category;
   import org.apache.torque.BaseTestCase;
   import org.apache.torque.test.Author;
   import org.apache.torque.test.AuthorPeer;
  
  
  
  1.3       +1 -6      jakarta-turbine-torque/src/rttest/org/apache/torque/util/LargeSelectTest.java
  
  Index: LargeSelectTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/rttest/org/apache/torque/util/LargeSelectTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LargeSelectTest.java	2 Oct 2002 14:34:45 -0000	1.2
  +++ LargeSelectTest.java	9 Jan 2003 17:46:22 -0000	1.3
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.log4j.Category;
   import org.apache.torque.BaseTestCase;
   import org.apache.torque.TorqueException;
   import org.apache.torque.test.Author;
  @@ -70,10 +69,6 @@
    */
   public class LargeSelectTest extends BaseTestCase
   {
  -    /** Category used for logging in the runtime test class. */
  -    private static Category category =
  -            Category.getInstance(LargeSelectTest.class.getName());
  -
       private static final int TEST_PAGE_SIZE = 9;
       private static final int TEST_PAGES = 9;
       private static final int TEST_ROWS = TEST_PAGE_SIZE * TEST_PAGES;
  
  
  

Re: cvs commit: jakarta-turbine-torque/src/rttest/org/apache/torque/util

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Martin Poeschl <mp...@marmot.at> writes:

Inheriting variables from a parent is bad style anyway. So we should
put a 

Category category = Category.getInstance(...); into the template. IMHO.

	Regards
		Henning


>Andreou Andreas wrote:

>> Martin Poeschl wrote:
>>
>>>
>>>
>>> in BasePeer category was renamend to logger .. but category is used 
>>> within the templates ... so the generated code doesn't work :-(
>>>
>>> woulnd't it be better to deprecate category and add a getLog() method 
>>> as in BaseObject??
>>
>>
>> category is only used here:
>>
>> File jakarta-turbine-torque\src\templates\om\Peer.vm
>>  95 17:                category.error("Could not initialize Peer", e);
>>  131 13:            category.error("A FATAL ERROR has occurred which 
>> should not " 


>... but it may be used by the users extending the peers .. so we should 
>deprecate it instead of just renaming

>martin

>>
>>
>>
>>
>>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>



>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

Re: cvs commit: jakarta-turbine-torque/src/rttest/org/apache/torque/util CopyTest.java LargeSelectTest.java

Posted by Martin Poeschl <mp...@marmot.at>.
Andreou Andreas wrote:

> Martin Poeschl wrote:
>
>>
>>
>> in BasePeer category was renamend to logger .. but category is used 
>> within the templates ... so the generated code doesn't work :-(
>>
>> woulnd't it be better to deprecate category and add a getLog() method 
>> as in BaseObject??
>
>
> category is only used here:
>
> File jakarta-turbine-torque\src\templates\om\Peer.vm
>  95 17:                category.error("Could not initialize Peer", e);
>  131 13:            category.error("A FATAL ERROR has occurred which 
> should not " 


... but it may be used by the users extending the peers .. so we should 
deprecate it instead of just renaming

martin

>
>
>
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>



Re: cvs commit: jakarta-turbine-torque/src/rttest/org/apache/torque/util CopyTest.java LargeSelectTest.java

Posted by Andreou Andreas <an...@di.uoa.gr>.
Martin Poeschl wrote:

>
>
> in BasePeer category was renamend to logger .. but category is used 
> within the templates ... so the generated code doesn't work :-(
>
> woulnd't it be better to deprecate category and add a getLog() method 
> as in BaseObject??

category is only used here:

File jakarta-turbine-torque\src\templates\om\Peer.vm
  95 17:                category.error("Could not initialize Peer", e);
  131 13:            category.error("A FATAL ERROR has occurred which 
should not "





Re: cvs commit: jakarta-turbine-torque/src/rttest/org/apache/torque/util

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Martin Poeschl <mp...@marmot.at> writes:

>>  The whole shebang might cry for commons-logging though.
>>  
>>  
>>
>this breaks torque!!

>in BasePeer category was renamend to logger .. but category is used 
>within the templates ... so the generated code doesn't work :-(

>woulnd't it be better to deprecate category and add a getLog() method as 
>in BaseObject??

>why do we have category + logger in BaseObject???  ther should be only 
>one logger!!

Tell me how to get from a logger to a category and back. :-)

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

Re: cvs commit: jakarta-turbine-torque/src/rttest/org/apache/torque/util CopyTest.java LargeSelectTest.java

Posted by Martin Poeschl <mp...@marmot.at>.
henning@apache.org wrote:

>henning     2003/01/09 09:46:22
>
>  Modified:    .        build-legacy.xml
>               notes    PoolTest.java
>               src/java/org/apache/torque Torque.java
>               src/java/org/apache/torque/dsfactory
>                        AbstractDataSourceFactory.java
>                        Jdbc2PoolDataSourceFactory.java
>                        JndiDataSourceFactory.java
>                        TorqueDataSourceFactory.java
>               src/java/org/apache/torque/manager AbstractBaseManager.java
>                        MethodResultCache.java
>               src/java/org/apache/torque/oid IDBroker.java
>                        SequenceIdGenerator.java
>               src/java/org/apache/torque/om BaseObject.java
>               src/java/org/apache/torque/pool ConnectionPool.java
>               src/java/org/apache/torque/util BasePeer.java Criteria.java
>                        LargeSelect.java Transaction.java
>               src/rttest/org/apache/torque DataTest.java
>               src/rttest/org/apache/torque/util CopyTest.java
>                        LargeSelectTest.java
>  Log:
>  - Removed all Category references from the code and replaced with log4j
>    logger as Category is deprecated and will be gone shortly according to
>    the log4j javadocs.
>  
>  - kept the log() method in BaseObject because it is user visible but
>    deprecated it and added a getLog() method which returns a Logger object
>  
>  The whole shebang might cry for commons-logging though.
>  
>  
>
this breaks torque!!

in BasePeer category was renamend to logger .. but category is used 
within the templates ... so the generated code doesn't work :-(

woulnd't it be better to deprecate category and add a getLog() method as 
in BaseObject??

why do we have category + logger in BaseObject???  ther should be only 
one logger!!

martin