db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1870542 - in /db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/ main/java/org/apache/torque/adapter/ main/java/org/apache/torque/dsfactory/ main/java/org/apache/torque/manager/ main/java/org/apache/torque/oid/ main/j...
Date Thu, 28 Nov 2019 09:32:40 GMT
Author: tv
Date: Thu Nov 28 09:32:40 2019
New Revision: 1870542

URL: http://svn.apache.org/viewvc?rev=1870542&view=rev
Log:
Use log4j2

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPool2DataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPool2DataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManagerImpl.java
    db/torque/torque4/trunk/torque-runtime/src/test/resources/log4j2-test.xml

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/TorqueInstance.java Thu Nov 28 09:32:40 2019
@@ -38,8 +38,8 @@ import org.apache.commons.configuration2
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.jcs.JCS;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.adapter.Adapter;
 import org.apache.torque.adapter.AdapterFactory;
 import org.apache.torque.adapter.IDMethod;
@@ -74,7 +74,7 @@ import org.apache.torque.util.Transactio
 public class TorqueInstance
 {
     /** Logging */
-    private static Log log = LogFactory.getLog(TorqueInstance.class);
+    private static final Logger log = LogManager.getLogger(TorqueInstance.class);
 
     /** A constant for <code>default</code>. */
     private static final String DEFAULT_NAME = "default";
@@ -189,9 +189,8 @@ public class TorqueInstance
                     && databaseInfoForKeyDefault.getDataSourceFactory() == null)
             {
                 log.debug("Adding the DatasourceFactory and DatabaseAdapter "
-                        + "from database "
-                        + defaultDBName
-                        + " onto database " + DEFAULT_NAME);
+                        + "from database {} onto database {}",
+                        defaultDBName, DEFAULT_NAME);
                 databaseInfoForKeyDefault.setDataSourceFactory(
                         defaultDatabase.getDataSourceFactory());
                 databaseInfoForKeyDefault.setAdapter(
@@ -222,7 +221,7 @@ public class TorqueInstance
     private void initTransactionManager(final Configuration conf)
             throws TorqueException
     {
-        log.debug("initTransactionManager(" + conf + ")");
+        log.debug("initTransactionManager({})", conf);
 
         String transactionManagerClassName =
                 conf.getString(Torque.TRANSACTION_MANAGER_KEY);
@@ -231,10 +230,8 @@ public class TorqueInstance
         {
             if (log.isTraceEnabled())
             {
-                log.trace("Configuration key " + Torque.TORQUE_KEY + "."
-                        + Torque.TRANSACTION_MANAGER_KEY
-                        + " not set, using default transaction manager "
-                        + TransactionManagerImpl.class.getName());
+                log.trace("Configuration key {}.{} not set, using default transaction manager {}",
+                        Torque.TORQUE_KEY, Torque.TRANSACTION_MANAGER_KEY, TransactionManagerImpl.class.getName());
             }
             transactionManager = new TransactionManagerImpl();
         }
@@ -242,20 +239,17 @@ public class TorqueInstance
         {
             try
             {
-                Class<?> transactionManagerClass
-                = Class.forName(transactionManagerClassName);
+                Class<?> transactionManagerClass = Class.forName(transactionManagerClassName);
                 transactionManager = (TransactionManager)
                         transactionManagerClass.newInstance();
                 if (log.isTraceEnabled())
                 {
-                    log.trace("Using transaction manager "
-                            + transactionManager.getClass().getName());
+                    log.trace("Using transaction manager {}", transactionManager.getClass().getName());
                 }
             }
             catch (Exception e)
             {
-                log.error("Error handling transaction manager configuration",
-                        e);
+                log.error("Error handling transaction manager configuration", e);
                 throw new TorqueException(e);
             }
         }
@@ -276,7 +270,7 @@ public class TorqueInstance
     private void initDefaultDbName(final Configuration conf)
             throws TorqueException
     {
-        log.debug("initDefaultDbName(" + conf + ")");
+        log.debug("initDefaultDbName({})", conf);
 
         // Determine default database name.
         defaultDBName =
@@ -312,7 +306,7 @@ public class TorqueInstance
     private void initAdapters(final Configuration conf)
             throws TorqueException
     {
-        log.debug("initAdapters(" + conf + ")");
+        log.debug("initAdapters({})", conf);
 
         Configuration c = conf.subset(Torque.DATABASE_KEY);
         if (c == null || c.isEmpty())
@@ -332,8 +326,7 @@ public class TorqueInstance
             for (Iterator<?> it = c.getKeys(); it.hasNext();)
             {
                 String key = (String) it.next();
-                if (key.endsWith(Adapter.ADAPTER_KEY)
-                        || key.endsWith(Adapter.DRIVER_KEY))
+                if (key.endsWith(Adapter.ADAPTER_KEY) || key.endsWith(Adapter.DRIVER_KEY))
                 {
                     String adapterKey = c.getString(key);
                     String handle = key.substring(0, key.indexOf('.'));
@@ -352,10 +345,8 @@ public class TorqueInstance
                         }
                         catch (SQLException e)
                         {
-                            log.error(
-                                    "Could not get product information from JDBC",
-                                    e);
-                             throw new InstantiationException(e.getMessage());
+                            log.error("Could not get product information from JDBC", e);
+                            throw new InstantiationException(e.getMessage());
                         }
                     }
                     else
@@ -375,8 +366,7 @@ public class TorqueInstance
 
                     // register the adapter for this name
                     database.setAdapter(adapter);
-                    log.debug("Adding " + adapterKey + " -> "
-                            + handle + " as Adapter");
+                    log.debug("Adding {} -> {} as Adapter", adapterKey, handle);
 
                     // try to get additional meta data from the driver
                     try (Connection con = database.getDataSourceFactory()
@@ -406,10 +396,8 @@ public class TorqueInstance
         }
 
         // check that at least the default database has got an adapter.
-        Database defaultDatabase
-        = databases.get(getDefaultDB());
-        if (defaultDatabase == null
-                || defaultDatabase.getAdapter() == null)
+        Database defaultDatabase = databases.get(getDefaultDB());
+        if (defaultDatabase == null || defaultDatabase.getAdapter() == null)
         {
             String error = "Invalid configuration : "
                     + "No adapter definition found for default DB "
@@ -443,7 +431,7 @@ public class TorqueInstance
     private void initDataSourceFactories(final Configuration conf)
             throws TorqueException
     {
-        log.debug("initDataSourceFactories(" + conf + ")");
+        log.debug("initDataSourceFactories({})", conf);
 
         Configuration c = conf.subset(DataSourceFactory.DSFACTORY_KEY);
         if (c == null || c.isEmpty())
@@ -468,11 +456,9 @@ public class TorqueInstance
                 {
                     String classname = c.getString(key);
                     String handle = key.substring(0, key.indexOf('.'));
-                    log.debug("handle: " + handle
-                            + " DataSourceFactory: " + classname);
+                    log.debug("handle: {} DataSourceFactory: {}", handle, classname);
                     Class<?> dsfClass = Class.forName(classname);
-                    DataSourceFactory dsf =
-                            (DataSourceFactory) dsfClass.newInstance();
+                    DataSourceFactory dsf = (DataSourceFactory) dsfClass.newInstance();
                     Configuration subConf = c.subset(handle);
                     dsf.initialize(subConf);
 
@@ -492,10 +478,8 @@ public class TorqueInstance
             throw new TorqueException(e);
         }
 
-        Database defaultDatabase
-        = databases.get(defaultDBName);
-        if (defaultDatabase == null
-                || defaultDatabase.getDataSourceFactory() == null)
+        Database defaultDatabase = databases.get(defaultDBName);
+        if (defaultDatabase == null || defaultDatabase.getDataSourceFactory() == null)
         {
             String error = "Invalid configuration : "
                     + "No DataSourceFactory definition for default DB found. "
@@ -524,7 +508,7 @@ public class TorqueInstance
     private void initSchemata(final Configuration conf)
             throws TorqueException
     {
-        log.debug("initSchemata(" + conf + ")");
+        log.debug("initSchemata({})", conf);
 
         // read schema configuration from database setting
         Configuration c = conf.subset(Torque.DATABASE_KEY);
@@ -551,7 +535,7 @@ public class TorqueInstance
                 }
                 String handle = key.substring(0, indexOfDot);
 
-                log.debug("database handle: " + handle);
+                log.debug("database handle: {}", handle);
                 Configuration subConf = c.subset(handle);
 
                 Database database = getOrCreateDatabase(handle);
@@ -596,11 +580,12 @@ public class TorqueInstance
     public void init(final String configFile)
             throws TorqueException
     {
-        log.debug("init(" + configFile + ")");
+        log.debug("init({})", configFile);
         try
         {
             Configuration configuration;
-            if (!configFile.endsWith("xml")) {
+            if (!configFile.endsWith("xml")) 
+            {
 
                 FileBasedConfigurationBuilder<PropertiesConfiguration> propertiesBuilder = new FileBasedConfigurationBuilder<>(
                         PropertiesConfiguration.class)
@@ -611,7 +596,9 @@ public class TorqueInstance
                                         .setListDelimiterHandler(new DefaultListDelimiterHandler(','))
                                  );
                 configuration = propertiesBuilder.getConfiguration();
-            } else {
+            }
+            else
+            {
                 CombinedConfigurationBuilder combinedBuilder = new CombinedConfigurationBuilder()
                         .configure(new Parameters().fileBased()
                                 .setFileName(configFile)
@@ -620,7 +607,7 @@ public class TorqueInstance
                 configuration = combinedBuilder.getConfiguration();
             }
 
-            log.debug("Config Object is " + configuration);
+            log.debug("Config Object is {}", configuration);
 
             init(configuration);
         }
@@ -641,7 +628,7 @@ public class TorqueInstance
     public synchronized void init(final Configuration conf)
             throws TorqueException
     {
-        log.debug("init(" + conf + ")");
+        log.debug("init({})", conf);
         setConfiguration(conf);
         initialize();
     }
@@ -687,8 +674,8 @@ public class TorqueInstance
                 if (!managers.containsKey(managedClassKey))
                 {
                     String managerClass = conf.getString(key);
-                    log.info("Added Manager for Class: " + managedClassKey
-                            + " -> " + managerClass);
+                    log.info("Added Manager for Class: {} -> {}", 
+                            managedClassKey, managerClass);
                     try
                     {
                         initManager(managedClassKey, managerClass);
@@ -724,8 +711,7 @@ public class TorqueInstance
             {
                 try
                 {
-                    return (AbstractBaseManager<?>)
-                            Class.forName(className).newInstance();
+                    return (AbstractBaseManager<?>) Class.forName(className).newInstance();
                 }
                 catch (Exception e)
                 {
@@ -770,7 +756,7 @@ public class TorqueInstance
     public void setConfiguration(final Configuration conf)
             throws TorqueException
     {
-        log.debug("setConfiguration(" + conf + ")");
+        log.debug("setConfiguration({})", conf);
 
         Configuration subConf = conf.subset(Torque.TORQUE_KEY);
         if (subConf == null || subConf.isEmpty())
@@ -791,7 +777,7 @@ public class TorqueInstance
      */
     public Configuration getConfiguration()
     {
-        log.debug("getConfiguration() = " + conf);
+        log.debug("getConfiguration() = {}", conf);
         return conf;
     }
 
@@ -808,7 +794,7 @@ public class TorqueInstance
         T m = (T) managers.get(name);
         if (m == null)
         {
-            log.error("No configured manager for key " + name + ".");
+            log.error("No configured manager for key {}.", name);
         }
         return m;
     }
@@ -830,8 +816,7 @@ public class TorqueInstance
         T m = (T) managers.get(name);
         if (m == null)
         {
-            log.debug("Added late Manager mapping for Class: "
-                    + name + " -> " + defaultClassName);
+            log.debug("Added late Manager mapping for Class: {} -> {}", name, defaultClassName);
 
             try
             {
@@ -876,7 +861,7 @@ public class TorqueInstance
         P p = (P) peers.get(omClass);
         if (p == null)
         {
-            log.error("No registered peer for class " + omClass + ".");
+            log.error("No registered peer for class {}.", omClass);
         }
         return p;
     }
@@ -932,8 +917,8 @@ public class TorqueInstance
             }
             catch (TorqueException e)
             {
-                log.error("Error while closing the DataSourceFactory "
-                        + databaseKey,
+                log.error("Error while closing the DataSourceFactory {}",
+                        databaseKey,
                         e);
                 if (exception == null)
                 {

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AdapterFactory.java Thu Nov 28 09:32:40 2019
@@ -25,8 +25,8 @@ import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 
 /**
  * This class creates different {@link org.apache.torque.adapter.Adapter}
@@ -43,7 +43,7 @@ import org.apache.commons.logging.LogFac
 public final class AdapterFactory
 {
     /** Local logger */
-    private static final Log log = LogFactory.getLog(AdapterFactory.class);
+    private static final Logger log = LogManager.getLogger(AdapterFactory.class);
 
     /**
      * JDBC driver to Torque Adapter map.
@@ -122,7 +122,7 @@ public final class AdapterFactory
             throw new InstantiationException("Could not detect adapter for database: " + dbmsName);
         }
 
-        log.info("Mapped database product " + dbmsName + " to adapter " + adapter.getClass().getSimpleName());
+        log.info("Mapped database product {} to adapter {}", dbmsName, adapter.getClass().getSimpleName());
 
         return adapter;
     }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/AbstractDataSourceFactory.java Thu Nov 28 09:32:40 2019
@@ -28,8 +28,8 @@ import org.apache.commons.beanutils.Conv
 import org.apache.commons.beanutils.MappedPropertyDescriptor;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
 import org.apache.torque.TorqueRuntimeException;
@@ -63,7 +63,7 @@ implements DataSourceFactory
     = DEFAULTS_KEY + "." + CONNECTION_KEY;
 
     /** The log */
-    private static Log log = LogFactory.getLog(AbstractDataSourceFactory.class);
+    private static final Logger log = LogManager.getLogger(AbstractDataSourceFactory.class);
 
     /**
      * Encapsulates setting configuration properties on
@@ -102,18 +102,9 @@ implements DataSourceFactory
                     String subProp = (String) j.next();
                     String propVal = subProps.getString(subProp);
                     Object value = ConvertUtils.convert(propVal, propertyType);
-                    PropertyUtils
-                    .setMappedProperty(ds, property, subProp, value);
+                    PropertyUtils.setMappedProperty(ds, property, subProp, value);
 
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("setMappedProperty("
-                                + ds + ", "
-                                + property + ", "
-                                + subProp + ", "
-                                + value
-                                + ")");
-                    }
+                    log.debug("setMappedProperty({}, {}, {}, {})", ds, property, subProp, value);
                 }
             }
             else
@@ -126,14 +117,8 @@ implements DataSourceFactory
                     // so it is assumed here that the password is a String
                     String value = c.getString(property);
                     PropertyUtils.setSimpleProperty(ds, property, value);
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("setSimpleProperty("
-                                + ds + ", "
-                                + property + ", "
-                                + " (value not logged)"
-                                + ")");
-                    }
+
+                    log.debug("setSimpleProperty({}, {}, (value not logged))", ds, property);
                 }
                 else
                 {
@@ -143,14 +128,7 @@ implements DataSourceFactory
                             ConvertUtils.convert(c.getString(property), propertyType);
                     PropertyUtils.setSimpleProperty(ds, property, value);
 
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("setSimpleProperty("
-                                + ds + ", "
-                                + property + ", "
-                                + value
-                                + ")");
-                    }
+                    log.debug("setSimpleProperty({}, {}, {})", ds, property, value);
                 }
             }
         }
@@ -161,13 +139,8 @@ implements DataSourceFactory
         }
         catch (Exception e)
         {
-            log.error(
-                    "Property: "
-                            + property
-                            + " value: "
-                            + c.getString(key)
-                            + " is not supported by DataSource: "
-                            + ds.getClass().getName());
+            log.error("Property: {}  value: {}  is not supported by DataSource: {}",
+                    property, c.getString(key), ds.getClass().getName());
         }
     }
 
@@ -183,7 +156,7 @@ implements DataSourceFactory
     protected void applyConfiguration(final Configuration c, final Object o)
             throws TorqueException
     {
-        log.debug("applyConfiguration(" + c + ", " + o + ")");
+        log.debug("applyConfiguration({}, {})", c, o);
 
         if (c != null)
         {
@@ -218,8 +191,7 @@ implements DataSourceFactory
 
         if (c == null || c.isEmpty())
         {
-            log.warn("Global Configuration not set,"
-                    + " no Default connection pool data source configured!");
+            log.warn("Global Configuration not set, no Default connection pool data source configured!");
         }
         else
         {
@@ -249,8 +221,7 @@ implements DataSourceFactory
 
         if (c == null || c.isEmpty())
         {
-            log.warn("Global Configuration not set,"
-                    + " no Default pool data source configured!");
+            log.warn("Global Configuration not set, no Default pool data source configured!");
         }
         else
         {

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/JndiDataSourceFactory.java Thu Nov 28 09:32:40 2019
@@ -31,8 +31,8 @@ import javax.naming.NamingException;
 import javax.sql.DataSource;
 
 import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.TorqueException;
 
 /**
@@ -79,7 +79,7 @@ extends AbstractDataSourceFactory
     public static final String CLASSNAME_KEY = "classname";
 
     /** The log. */
-    private static Log log = LogFactory.getLog(JndiDataSourceFactory.class);
+    private static final Logger log = LogManager.getLogger(JndiDataSourceFactory.class);
 
     /** The path to get the resource from. */
     private String path;
@@ -159,27 +159,18 @@ extends AbstractDataSourceFactory
                 if (key.equals(PATH_KEY))
                 {
                     path = c.getString(key);
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("JNDI path: " + path);
-                    }
+                    log.debug("JNDI path: {}", path);
                 }
                 else if (key.equals(TIME_BETWEEN_LOOKUPS_KEY))
                 {
                     ttl = c.getLong(key, ttl);
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("Time between context lookups: " + ttl);
-                    }
+                    log.debug("Time between context lookups: {} ms", ttl);
                 }
                 else
                 {
                     String value = c.getString(key);
                     env.put(key, value);
-                    if (log.isDebugEnabled())
-                    {
-                        log.debug("Set jndi property: " + key + "=" + value);
-                    }
+                    log.debug("Set jndi property: {} = {}", key, value);
                 }
             }
 
@@ -217,10 +208,7 @@ extends AbstractDataSourceFactory
                     if (key.equals(CLASSNAME_KEY))
                     {
                         String classname = c.getString(key);
-                        if (log.isDebugEnabled())
-                        {
-                            log.debug("Datasource class: " + classname);
-                        }
+                        log.debug("Datasource class: {}", classname);
 
                         Class<?> dsClass = Class.forName(classname);
                         dataSource = dsClass.newInstance();
@@ -229,16 +217,12 @@ extends AbstractDataSourceFactory
                     {
                         if (dataSource != null)
                         {
-                            if (log.isDebugEnabled())
-                            {
-                                log.debug("Setting datasource property: " + key);
-                            }
+                            log.debug("Setting datasource property: {}", key);
                             setProperty(key, c, dataSource);
                         }
                         else
                         {
-                            log.error("Tried to set property " + key
-                                    + " without Datasource definition!");
+                            log.error("Tried to set property {} without Datasource definition!", key);
                         }
                     }
                 }
@@ -278,8 +262,8 @@ extends AbstractDataSourceFactory
     {
         log.debug("InitialContext -------------------------------");
         Map<?, ?> env = ctx.getEnvironment();
-        log.debug("Environment properties:" + env.size());
-        env.forEach((key, value) -> log.debug("    " + key + ": " + value));
+        log.debug("Environment properties: {}", env.size());
+        env.forEach((key, value) -> log.debug("    {}: {}", key, value));
         log.debug("----------------------------------------------");
     }
 
@@ -310,18 +294,17 @@ extends AbstractDataSourceFactory
                 try
                 {
                     ctx.createSubcontext(subctx);
-                    log.debug("Added sub context: " + subctx);
+                    log.debug("Added sub context: {}", subctx);
                 }
                 catch (NameAlreadyBoundException nabe)
                 {
                     // ignore
-                    log.debug("Sub context " + subctx + " already exists");
+                    log.debug("Sub context {} already exists", subctx);
                 }
                 catch (NamingException ne)
                 {
-                    log.debug("Naming exception caught "
-                            + "when creating subcontext"
-                            + subctx,
+                    log.debug("Naming exception caught when creating subcontext {}",
+                            subctx,
                             ne);
                     // even though there is a specific exception
                     // for this condition, some implementations

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPool2DataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPool2DataSourceFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPool2DataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPool2DataSourceFactory.java Thu Nov 28 09:32:40 2019
@@ -25,8 +25,8 @@ import javax.sql.DataSource;
 import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS;
 import org.apache.commons.dbcp2.datasources.PerUserPoolDataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.TorqueException;
 
 /**
@@ -40,8 +40,7 @@ extends AbstractDataSourceFactory
 {
 
     /** The log. */
-    private static Log log
-    = LogFactory.getLog(PerUserPool2DataSourceFactory.class);
+    private static final Logger log = LogManager.getLogger(PerUserPool2DataSourceFactory.class);
 
     /** The wrapped <code>DataSource</code>. */
     private PerUserPoolDataSource ds = null;

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/PerUserPoolDataSourceFactory.java Thu Nov 28 09:32:40 2019
@@ -25,8 +25,8 @@ import javax.sql.DataSource;
 import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
 import org.apache.commons.dbcp.datasources.PerUserPoolDataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.TorqueException;
 
 /**
@@ -42,8 +42,7 @@ extends AbstractDataSourceFactory
 {
 
     /** The log. */
-    private static Log log
-    = LogFactory.getLog(PerUserPoolDataSourceFactory.class);
+    private static final Logger log = LogManager.getLogger(PerUserPoolDataSourceFactory.class);
 
     /** The wrapped <code>DataSource</code>. */
     private PerUserPoolDataSource ds = null;

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPool2DataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPool2DataSourceFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPool2DataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPool2DataSourceFactory.java Thu Nov 28 09:32:40 2019
@@ -25,8 +25,8 @@ import javax.sql.DataSource;
 import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS;
 import org.apache.commons.dbcp2.datasources.SharedPoolDataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.TorqueException;
 
 /**
@@ -40,8 +40,7 @@ extends AbstractDataSourceFactory
 {
 
     /** The log. */
-    private static Log log
-    = LogFactory.getLog(SharedPool2DataSourceFactory.class);
+    private static final Logger log = LogManager.getLogger(SharedPool2DataSourceFactory.class);
 
     /** The wrapped <code>DataSource</code>. */
     private SharedPoolDataSource ds = null;

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/dsfactory/SharedPoolDataSourceFactory.java Thu Nov 28 09:32:40 2019
@@ -25,8 +25,8 @@ import javax.sql.DataSource;
 import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
 import org.apache.commons.dbcp.datasources.SharedPoolDataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.TorqueException;
 
 /**
@@ -42,8 +42,7 @@ extends AbstractDataSourceFactory
 {
 
     /** The log. */
-    private static Log log
-    = LogFactory.getLog(SharedPoolDataSourceFactory.class);
+    private static final Logger log = LogManager.getLogger(SharedPoolDataSourceFactory.class);
 
     /** The wrapped <code>DataSource</code>. */
     private SharedPoolDataSource ds = null;

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/AbstractBaseManager.java Thu Nov 28 09:32:40 2019
@@ -37,8 +37,8 @@ import org.apache.commons.jcs.JCS;
 import org.apache.commons.jcs.access.CacheAccess;
 import org.apache.commons.jcs.access.GroupCacheAccess;
 import org.apache.commons.jcs.access.exception.CacheException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Column;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
@@ -60,7 +60,7 @@ implements Serializable
     private static final long serialVersionUID = 509798299473481305L;
 
     /** the log */
-    protected static final Log log = LogFactory.getLog(AbstractBaseManager.class);
+    protected static final Logger log = LogManager.getLogger(AbstractBaseManager.class);
 
     /** used to cache the om objects. cache is set by the region property */
     protected transient CacheAccess<ObjectKey<?>, T> cache;
@@ -512,7 +512,7 @@ implements Serializable
 
         if (cache == null)
         {
-            log.info("Cache could not be initialized for region: " + v);
+            log.info("Cache could not be initialized for region: {}", v);
         }
     }
 
@@ -633,8 +633,7 @@ implements Serializable
         }
         catch (TorqueException e)
         {
-            log.error("Cache could not be initialized for region '"
-                    + region + "' after deserialization");
+            log.error("Cache could not be initialized for region '{}' after deserialization", region);
         }
     }
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/manager/MethodResultCache.java Thu Nov 28 09:32:40 2019
@@ -23,8 +23,8 @@ import java.io.Serializable;
 
 import org.apache.commons.jcs.access.GroupCacheAccess;
 import org.apache.commons.jcs.access.exception.CacheException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.TorqueException;
 
 /**
@@ -40,7 +40,7 @@ public class MethodResultCache
     private GroupCacheAccess<MethodCacheKey, Object> jcsCache;
 
     /** Logging */
-    private static Log log = LogFactory.getLog(MethodResultCache.class);
+    private static final Logger log = LogManager.getLogger(MethodResultCache.class);
 
     /**
      * Constructor
@@ -89,9 +89,9 @@ public class MethodResultCache
             result = jcsCache.getFromGroup(key, key.getGroupKey());
         }
 
-        if (result != null && log.isDebugEnabled())
+        if (result != null)
         {
-            log.debug("MethodResultCache saved expensive operation: " + key);
+            log.debug("MethodResultCache saved expensive operation: {}", key);
         }
 
         return result;
@@ -113,8 +113,7 @@ public class MethodResultCache
             }
             catch (CacheException ce)
             {
-                throw new TorqueException
-                ("Could not cache due to internal JCS error", ce);
+                throw new TorqueException("Could not cache due to internal JCS error", ce);
             }
         }
         return old;

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/IDBroker.java Thu Nov 28 09:32:40 2019
@@ -32,8 +32,8 @@ import java.util.concurrent.ConcurrentHa
 import java.util.concurrent.ConcurrentMap;
 
 import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Database;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
@@ -189,7 +189,7 @@ public class IDBroker implements Runnabl
             "idbroker.usenewconnection";
 
     /** the log */
-    private final Log log = LogFactory.getLog(IDBroker.class);
+    private static final Logger log = LogManager.getLogger(IDBroker.class);
 
     /**
      * Constructs an IdBroker for the given Database.
@@ -233,20 +233,20 @@ public class IDBroker implements Runnabl
         catch (Exception e)
         {
             log.warn("Could not read from connection Metadata"
-                    + " whether transactions are supported for the database "
-                    + databaseName,
+                    + " whether transactions are supported for the database {}",
+                    databaseName,
                     e);
             transactionsSupported = false;
         }
         if (!transactionsSupported)
         {
-            log.warn("IDBroker is being used with db '" + databaseName
-                    + "', which does not support transactions. IDBroker "
+            log.warn("IDBroker is being used with db '{}', "
+                    + "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.");
+                    + "database.", databaseName);
         }
     }
 
@@ -451,18 +451,14 @@ public class IDBroker implements Runnabl
 
         if (availableIds == null || availableIds.size() < numOfIdsToReturn)
         {
-            if (log.isDebugEnabled())
+            if (availableIds == null)
             {
-                if (availableIds == null)
-                {
-                    log.debug("Forced id retrieval - no available list for table "
-                            + tableName);
-                }
-                else
-                {
-                    log.debug("Forced id retrieval - " + availableIds.size()
-                    + " ids still available for table " + tableName);
-                }
+                log.debug("Forced id retrieval - no available list for table {}", tableName);
+            }
+            else
+            {
+                log.debug("Forced id retrieval - {} ids still available for table {}", 
+                        availableIds.size(), tableName);
             }
             storeIDs(tableName, true, connection);
             availableIds = ids.get(tableName);
@@ -536,18 +532,13 @@ public class IDBroker implements Runnabl
             }
             catch (InterruptedException exc)
             {
-                log.trace("InterruptedException caught and ignored "
-                        + "during IdBroker sleep");
+                log.trace("InterruptedException caught and ignored during IdBroker sleep");
             }
 
             // logger.info("IDBroker thread checking for more keys.");
             ids.forEach((tableName, availableIds) ->
             {
-                if (log.isDebugEnabled())
-                {
-                    log.debug("IDBroker thread checking for more keys "
-                            + "on table: " + tableName);
-                }
+                log.debug("IDBroker thread checking for more keys on table: {}", tableName);
                 int quantity = getQuantity(tableName, null).intValue();
                 if (quantity > availableIds.size())
                 {
@@ -557,16 +548,12 @@ public class IDBroker implements Runnabl
                         // want the quantity to be adjusted for thread
                         // calls.
                         storeIDs(tableName, false, null);
-                        if (log.isDebugEnabled())
-                        {
-                            log.debug("Retrieved more ids for table: "
-                                    + tableName);
-                        }
+                        log.debug("Retrieved more ids for table: {}", tableName);
                     }
                     catch (Exception exc)
                     {
-                        log.error("There was a problem getting new IDs "
-                                + "for table: " + tableName, exc);
+                        log.error("There was a problem getting new IDs for table: {}",
+                                tableName, exc);
                     }
                 }
             });
@@ -623,12 +610,11 @@ public class IDBroker implements Runnabl
             long thenLong = lastTime.getTime();
             long nowLong = now.getTime();
             long timeLapse = nowLong - thenLong;
-            log.debug("checkTiming(): sleep time was "
-                    + timeLapse + " milliseconds for table " + tableName);
+            log.debug("checkTiming(): sleep time was {} milliseconds for table {}",
+                    timeLapse, tableName);
             if (timeLapse < SLEEP_PERIOD)
             {
-                log.debug("checkTiming(): Unscheduled retrieval of ids "
-                        + "for table " + tableName);
+                log.debug("checkTiming(): Unscheduled retrieval of ids for table {}", tableName);
                 // Increase quantity, so that hopefully this does not
                 // happen again.
                 BigDecimal quantity = getQuantity(tableName, null);
@@ -638,17 +624,16 @@ public class IDBroker implements Runnabl
                     float rate = quantity.floatValue() / timeLapse;
                     newQuantity
                     = Math.ceil(SLEEP_PERIOD * rate * SAFETY_MARGIN);
-                    log.debug("checkTiming(): calculated new quantity "
-                            + newQuantity + " from rate " + rate);
+                    log.debug("checkTiming(): calculated new quantity {} from rate {}",
+                            newQuantity, rate);
                 }
                 else
                 {
                     // time lapse is so small that it was not measurable
                     // use factor 2
                     newQuantity = quantity.floatValue() * 2;
-                    log.debug("checkTiming(): calculated new quantity "
-                            + newQuantity
-                            + " from double the old quantity (time lapse 0)");
+                    log.debug("checkTiming(): calculated new quantity {}"
+                            + " from double the old quantity (time lapse 0)", newQuantity);
                 }
 
                 BigDecimal bdNewQuantity = BigDecimal.valueOf(newQuantity);
@@ -668,8 +653,8 @@ public class IDBroker implements Runnabl
                     }
                 }
                 quantityStore.put(tableName, bdNewQuantity);
-                log.debug("checkTiming(): new quantity " + bdNewQuantity
-                        + " stored in quantity store (not in db)");
+                log.debug("checkTiming(): new quantity {} stored in quantity store (not in db)",
+                        bdNewQuantity);
             }
         }
     }
@@ -712,8 +697,7 @@ public class IDBroker implements Runnabl
                 connection = Transaction.begin(databaseName);
                 if (log.isTraceEnabled())
                 {
-                    log.trace("storeIDs(): fetched connection, "
-                            + "started transaction.");
+                    log.trace("storeIDs(): fetched connection, started transaction.");
                 }
             }
 
@@ -739,8 +723,7 @@ public class IDBroker implements Runnabl
                 Transaction.commit(connection);
                 if (log.isTraceEnabled())
                 {
-                    log.trace("storeIDs(): Transaction committed, "
-                            + "connection returned");
+                    log.trace("storeIDs(): Transaction committed, connection returned");
                 }
             }
         }
@@ -795,8 +778,8 @@ public class IDBroker implements Runnabl
         }
         else
         {
-            log.debug("getQuantity() : start fetch quantity for table "
-                    + tableName + " from database");
+            log.debug("getQuantity() : start fetch quantity for table {} from database",
+                    tableName);
             boolean useNewConnection = (connection == null) || (configuration
                     .getBoolean(DB_IDBROKER_USENEWCONNECTION, true));
             try
@@ -806,8 +789,7 @@ public class IDBroker implements Runnabl
                     connection = Transaction.begin(databaseName);
                     if (log.isTraceEnabled())
                     {
-                        log.trace("getQuantity(): connection fetched, "
-                                + "transaction started");
+                        log.trace("getQuantity(): connection fetched, transaction started");
                     }
                 }
 
@@ -817,16 +799,15 @@ public class IDBroker implements Runnabl
                 // QUANTITY column.
                 quantity = results[1];
                 quantityStore.put(tableName, quantity);
-                log.debug("getQuantity() : quantity fetched for table "
-                        + tableName + ", result is " + quantity);
+                log.debug("getQuantity() : quantity fetched for table {}, result is {}",
+                        tableName, quantity);
                 if (useNewConnection)
                 {
                     Transaction.commit(connection);
                     connection = null;
                     if (log.isTraceEnabled())
                     {
-                        log.trace("getQuantity(): transaction committed, "
-                                + "connection returned");
+                        log.trace("getQuantity(): transaction committed, connection returned");
                     }
                 }
             }
@@ -925,10 +906,7 @@ public class IDBroker implements Runnabl
         .append(tableName)
         .append('\'');
 
-        if (log.isDebugEnabled())
-        {
-            log.debug("updateNextId: " + stmt.toString());
-        }
+        log.debug("updateNextId: {}", () -> stmt.toString());
 
         try (Statement statement = con.createStatement())
         {
@@ -953,8 +931,7 @@ public class IDBroker implements Runnabl
             BigDecimal quantity)
                     throws TorqueException
     {
-        log.debug("updateQuantity(): start for table " + tableName
-                + " and quantity " + quantity);
+        log.debug("updateQuantity(): start for table {} and quantity {}", tableName, quantity);
         StringBuilder stmt = new StringBuilder();
         stmt.append("UPDATE ")
         .append(ID_TABLE)
@@ -968,10 +945,7 @@ public class IDBroker implements Runnabl
         .append(tableName)
         .append('\'');
 
-        if (log.isDebugEnabled())
-        {
-            log.debug("updateQuantity(): " + stmt.toString());
-        }
+        log.debug("updateQuantity(): {}", () -> stmt.toString());
 
         try (Statement statement = con.createStatement())
         {

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/SqlBuilder.java Thu Nov 28 09:32:40 2019
@@ -24,8 +24,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Column;
 import org.apache.torque.ColumnImpl;
 import org.apache.torque.Database;
@@ -65,7 +65,7 @@ import org.apache.torque.util.UniqueList
 public final class SqlBuilder
 {
     /** Logging */
-    protected static final Log log = LogFactory.getLog(SqlBuilder.class);
+    protected static final Logger log = LogManager.getLogger(SqlBuilder.class);
 
     /** Delimiters for SQL functions. */
     public static final String[] FUNCTION_DELIMITERS

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java Thu Nov 28 09:32:40 2019
@@ -38,8 +38,8 @@ import java.util.stream.StreamSupport;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.StopWatch;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Column;
 import org.apache.torque.ColumnImpl;
 import org.apache.torque.Database;
@@ -92,7 +92,7 @@ public class BasePeerImpl<T> implements
     private static final long serialVersionUID = -7702123730779032381L;
 
     /** the log */
-    private static final Log log = LogFactory.getLog(BasePeerImpl.class);
+    private static final Logger log = LogManager.getLogger(BasePeerImpl.class);
 
     /** An injected instance of a record mapper to map JDBC result sets to objects */
     private RecordMapper<T> recordMapper = null;
@@ -281,13 +281,11 @@ public class BasePeerImpl<T> implements
                     query.getPreparedStatementReplacements(),
                     0);
             StopWatch stopWatch = new StopWatch();
-            log.debug("Executing delete " + sql
-                    + ", parameters = "
-                    + replacements);
+            log.debug("Executing delete {}, parameters = {}", sql, replacements);
 
             stopWatch.start();
             int affectedRows = preparedStatement.executeUpdate();
-            log.trace("Delete took " + stopWatch.getTime() + " milliseconds");
+            log.trace("Delete took {} milliseconds", () -> stopWatch.getTime());
 
             return affectedRows;
         }
@@ -475,12 +473,12 @@ public class BasePeerImpl<T> implements
             }
 
             StopWatch stopWatch = new StopWatch();
-            log.debug("Executing insert " + query.toString()
-            + " using parameters " + replacementObjects);
+            log.debug("Executing insert {} using parameters {}", 
+                    () -> query.toString(), () -> replacementObjects);
 
             stopWatch.start();
             preparedStatement.executeUpdate();
-            log.trace("Insert took " + stopWatch.getTime() + " milliseconds");
+            log.trace("Insert took {} milliseconds", () -> stopWatch.getTime());
 
             if (keyGen != null && keyGen.isPostInsert()
                 && primaryKey != null
@@ -627,9 +625,9 @@ public class BasePeerImpl<T> implements
             Adapter adapter = Torque.getAdapter(dbName);
             if (idMethod == IDMethod.ID_BROKER)
             {
-                log.debug("pk does not exist in column map and id method is "
-                        + idMethod
-                        + ", SQL will fail if column has no default value");
+                log.debug("pk does not exist in column map and id method is {}, "
+                        + "SQL will fail if column has no default value",
+                        idMethod);
                 // try SQL, maybe database has a default value set
             }
             else if (idMethod == IDMethod.SEQUENCE
@@ -693,12 +691,12 @@ public class BasePeerImpl<T> implements
                     0);
 
             StopWatch stopWatch = new StopWatch();
-            log.debug("Executing insert " + query.toString()
-            + " using parameters " + replacements);
+            log.debug("Executing insert {} using parameters {}", 
+                    () -> query.toString(), () -> replacements);
 
             stopWatch.start();
             numberOfInsertedRows = preparedStatement.executeUpdate();
-            log.trace("Insert took " + stopWatch.getTime() + " milliseconds");
+            log.trace("Insert took {} milliseconds", () -> stopWatch.getTime());
         }
         catch (SQLException e)
         {
@@ -1114,13 +1112,13 @@ public class BasePeerImpl<T> implements
         {
             Statement statement = connection.createStatement();
             StopWatch stopWatch = new StopWatch();
-            log.debug("Executing query " + query);
+            log.debug("Executing query {}", query);
 
             stopWatch.start();
             ResultSet resultSet = statement.executeQuery(query.toString());
             ResultsetSpliterator<TT> spliterator =
                     new ResultsetSpliterator<>(mapper, null, statement, resultSet);
-            log.trace("Query took " + stopWatch.getTime() + " milliseconds");
+            log.trace("Query took {} milliseconds", () -> stopWatch.getTime());
 
             return StreamSupport.stream(spliterator, false).onClose(spliterator);
         }
@@ -1218,15 +1216,13 @@ public class BasePeerImpl<T> implements
                     0);
 
             StopWatch stopWatch = new StopWatch();
-            log.debug("Executing query " + query
-                    + ", parameters = "
-                    + replacements);
+            log.debug("Executing query {}, parameters = {}", query, replacements);
 
             stopWatch.start();
             ResultSet resultSet = statement.executeQuery();
             ResultsetSpliterator<TT> spliterator =
                     new ResultsetSpliterator<>(mapper, criteria, statement, resultSet);
-            log.trace("Query took " + stopWatch.getTime() + " milliseconds");
+            log.trace("Query took {} milliseconds", () -> stopWatch.getTime());
 
             return StreamSupport.stream(spliterator, false).onClose(spliterator);
         }
@@ -1483,14 +1479,12 @@ public class BasePeerImpl<T> implements
                     query.getPreparedStatementReplacements(),
                     position - 1);
             StopWatch stopWatch = new StopWatch();
-            log.debug("Executing update " + query.toString()
-            + " using update parameters " + replacementObjects
-            + " and query parameters "
-            + replacements);
+            log.debug("Executing update {} using update parameters {} and query parameters {}",
+                    () -> query.toString(), () -> replacementObjects, () -> replacements);
 
             stopWatch.start();
             int affectedRows = preparedStatement.executeUpdate();
-            log.trace("Update took " + stopWatch.getTime() + " milliseconds");
+            log.trace("Update took {} milliseconds", () -> stopWatch.getTime());
 
             return affectedRows;
         }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java Thu Nov 28 09:32:40 2019
@@ -28,8 +28,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Column;
 import org.apache.torque.ColumnImpl;
 import org.apache.torque.Torque;
@@ -91,7 +91,7 @@ import org.apache.torque.util.functions.
 public class SummaryHelper
 {
     /** The class log. */
-    private static Log logger = LogFactory.getLog(SummaryHelper.class);
+    private static final Logger log = LogManager.getLogger(SummaryHelper.class);
 
     /** A list of the group by columns. */
     private List<Column> groupByColumns;
@@ -272,14 +272,14 @@ public class SummaryHelper
         }
         if (haveFromTable)
         {
-            logger.debug("From table defined by Group By Cols");
+            log.debug("From table defined by Group By Cols");
         }
 
         // Check if the from table is set via a where clause.
         if (!haveFromTable && c.getTopLevelCriterion() != null)
         {
             haveFromTable = true;
-            logger.debug("From table defined by a where clause");
+            log.debug("From table defined by a where clause");
         }
 
         for (Map.Entry<String, SQLFunction> entry : getAggregates().entrySet())
@@ -302,8 +302,7 @@ public class SummaryHelper
                     haveFromTable = true;
 
                     String table = col.getTableName();
-                    logger.debug("From table, '" + table
-                            + "', defined from aggregate column");
+                    log.debug("From table, '{}', defined from aggregate column", table);
                 }
             }
         }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManagerImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManagerImpl.java?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManagerImpl.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManagerImpl.java Thu Nov 28 09:32:40 2019
@@ -22,8 +22,8 @@ package org.apache.torque.util;
 import java.sql.Connection;
 import java.sql.SQLException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
 
@@ -39,7 +39,7 @@ public class TransactionManagerImpl impl
 {
 
     /** The log. */
-    private static Log log = LogFactory.getLog(TransactionManagerImpl.class);
+    private static final Logger log = LogManager.getLogger(TransactionManagerImpl.class);
 
     /**
      * Begin a transaction by retrieving a connection from the default database

Modified: db/torque/torque4/trunk/torque-runtime/src/test/resources/log4j2-test.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/resources/log4j2-test.xml?rev=1870542&r1=1870541&r2=1870542&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/resources/log4j2-test.xml (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/resources/log4j2-test.xml Thu Nov 28 09:32:40 2019
@@ -18,21 +18,24 @@
  under the License.
 -->
 <Configuration status="warn" name="Torque" packages="">
-     <Appenders>
-       <Console name="console" target="SYSTEM_OUT">
-          <PatternLayout pattern="%d [%t] %-5p | %c - %m%n"/>
-      </Console>
-      <File name="torque" fileName="./target/torque-gen/log/torque-gen.log">
-          <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
+    <Appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d [%t] %-5p | %c - %m%n" />
+        </Console>
+        <File name="torque" fileName="./target/log/torque.log">
+            <PatternLayout pattern="%d [%t] %-5p %c - %m%n" />
         </File>
     </Appenders>
     <Loggers>
-          <Logger name="org.apache.torque" additivity="false" level="DEBUG">
-          <AppenderRef ref="torque" level="DEBUG"/>
-          <AppenderRef ref="console" level="INFO"/>
-      </Logger>
-      <Root level="INFO"><!-- log4j 1.2 has DEBUG -->
-          <AppenderRef ref="console"/>
-      </Root>
+        <Logger name="org.apache.torque" additivity="false" level="DEBUG">
+            <AppenderRef ref="torque" level="DEBUG" />
+            <AppenderRef ref="console" level="INFO" />
+        </Logger>
+        <Logger name="org.apache.commons.beanutils" additivity="false" level="WARN">
+            <AppenderRef ref="console" />
+        </Logger>
+        <Root level="INFO"><!-- log4j 1.2 has DEBUG -->
+            <AppenderRef ref="console" />
+        </Root>
     </Loggers>
 </Configuration>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message