From 53e805c8d1fea5d79302e1296e0189b05b787b3a Mon Sep 17 00:00:00 2001 From: berryware Date: Fri, 5 Dec 2025 16:27:03 -0500 Subject: [PATCH 1/2] clean up the log messages --- cpo-cassandra/pom.xml | 5 + .../cpo/cassandra/CassandraCpoAdapter.java | 86 ++------------ cpo-core/pom.xml | 5 + .../org/synchronoss/cpo/CpoBaseAdapter.java | 36 ++++++ cpo-jdbc/pom.xml | 11 +- .../synchronoss/cpo/jdbc/JdbcCpoAdapter.java | 108 ++---------------- .../cpo/jdbc/JdbcCpoAttribute.java | 10 -- cpo-jdbc/src/test/resources/logback.xml | 5 +- pom.xml | 6 + 9 files changed, 85 insertions(+), 187 deletions(-) diff --git a/cpo-cassandra/pom.xml b/cpo-cassandra/pom.xml index ee1e8540b..b2f5a740c 100644 --- a/cpo-cassandra/pom.xml +++ b/cpo-cassandra/pom.xml @@ -126,6 +126,11 @@ ${logbackVersion} test + + + org.apache.logging.log4j + log4j-to-slf4j + org.apache.xmlbeans xmlbeans diff --git a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java index cb81cba4e..4707fb420 100644 --- a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java +++ b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java @@ -427,14 +427,7 @@ protected long processUpdateGroup( cpoClass .getFunctionGroup(adjustCrud(bean, crud, groupName, sess), groupName) .getFunctions(); - localLogger.info( - "=================== Class=<" - + bean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(bean.getClass(), crud, groupName)); for (CpoFunction cpoFunction : cpoFunctions) { CassandraBoundStatementFactory boundStatementFactory = @@ -442,15 +435,7 @@ protected long processUpdateGroup( sess, this, cpoClass, cpoFunction, bean, wheres, orderBy, nativeExpressions); executeBoundStatement(sess, boundStatementFactory); } - localLogger.info( - "=================== " - + " Updates - Class=<" - + bean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildExecutedLogLine(bean.getClass(), crud, groupName)); } catch (Throwable t) { String msg = "ProcessUpdateGroup failed:" @@ -533,14 +518,7 @@ protected long processUpdateGroup( localLogger = LoggerFactory.getLogger(cpoClass.getMetaClass()); int numStatements = 0; - localLogger.info( - "=================== Class=<" - + beanInstance.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(beanInstance.getClass(), crud, groupName)); ArrayList statemetnFactories = new ArrayList<>(); for (T bean : beans) { for (CpoFunction function : cpoFunctions) { @@ -555,15 +533,7 @@ protected long processUpdateGroup( executeBatchStatements(sess, statemetnFactories); localLogger.info( - "=================== " - + numStatements - + " Updates - Class=<" - + beanInstance.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + buildUpdatesLogLine(numStatements, beanInstance.getClass(), crud, groupName)); } catch (Throwable t) { String msg = @@ -653,14 +623,7 @@ protected T processSelectGroup( List functions = cpoClass.getFunctionGroup(Crud.RETRIEVE, groupName).getFunctions(); - localLogger.info( - "=================== Class=<" - + criteriaObj.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(criteriaObj.getClass(), Crud.RETRIEVE, groupName)); try { rObj = (T) bean.getClass().newInstance(); @@ -734,26 +697,11 @@ protected T processSelectGroup( if (!recordsExist) { rObj = null; localLogger.info( - "=================== 0 Records - 0 Attributes - Class=<" - + criteriaObj.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + buildRecordsLogLine(0, 0, criteriaObj.getClass(), Crud.RETRIEVE, groupName)); } else { localLogger.info( - "=================== " - + recordCount - + " Records - " - + attributesSet - + " Attributes - Class=<" - + criteriaObj.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + buildRecordsLogLine( + recordCount, attributesSet, criteriaObj.getClass(), Crud.RETRIEVE, groupName)); } } catch (Throwable t) { String msg = "processSelectGroup(T) failed: " + ExceptionHelper.getLocalizedMessage(t); @@ -833,24 +781,10 @@ protected Stream processSelectGroup( criteriaClass = metaDescriptor.getMetaClass(criteria); resultClass = metaDescriptor.getMetaClass(result); if (useRetrieve) { - localLogger.info( - "=================== Class=<" - + criteria.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(criteria.getClass(), Crud.RETRIEVE, groupName)); cpoFunctions = criteriaClass.getFunctionGroup(Crud.RETRIEVE, groupName).getFunctions(); } else { - localLogger.info( - "=================== Class=<" - + criteria.getClass() - + "> Type=<" - + Crud.LIST.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(criteria.getClass(), Crud.LIST, groupName)); cpoFunctions = criteriaClass.getFunctionGroup(Crud.LIST, groupName).getFunctions(); } diff --git a/cpo-core/pom.xml b/cpo-core/pom.xml index 0b9e64264..1283fe79a 100644 --- a/cpo-core/pom.xml +++ b/cpo-core/pom.xml @@ -49,6 +49,11 @@ javax.servlet javax.servlet-api + + + org.apache.logging.log4j + log4j-to-slf4j + ch.qos.logback diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/CpoBaseAdapter.java b/cpo-core/src/main/java/org/synchronoss/cpo/CpoBaseAdapter.java index 810897ebc..1e9a7eb24 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/CpoBaseAdapter.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/CpoBaseAdapter.java @@ -595,4 +595,40 @@ protected abstract Stream processSelectGroup( Collection nativeExpressions, boolean useRetrieve) throws CpoException; + + private String buildClassInfo(Class clazz, Crud crud, String groupName) { + return "Class=<" + + clazz.getSimpleName() + + "> Function=<" + + crud.operation + + "> Group=<" + + groupName + + "> =========="; + } + + protected String buildCpoClassLogLine(Class clazz, Crud crud, String groupName) { + return "========== " + buildClassInfo(clazz, crud, groupName); + } + + protected String buildExecutedLogLine(Class clazz, Crud crud, String groupName) { + return "========== Executed - " + buildClassInfo(clazz, crud, groupName); + } + + protected String buildBatchLogLine(Class clazz, Crud crud, String groupName) { + return "========== BATCH - " + buildClassInfo(clazz, crud, groupName); + } + + protected String buildUpdatesLogLine(long updates, Class clazz, Crud crud, String groupName) { + return "========== " + updates + " Updates - " + buildClassInfo(clazz, crud, groupName); + } + + protected String buildRecordsLogLine( + long records, int attributes, Class clazz, Crud crud, String groupName) { + return "========== " + + records + + " Records - " + + attributes + + " Attributes - " + + buildClassInfo(clazz, crud, groupName); + } } diff --git a/cpo-jdbc/pom.xml b/cpo-jdbc/pom.xml index d9469de43..1b6ed3ab0 100644 --- a/cpo-jdbc/pom.xml +++ b/cpo-jdbc/pom.xml @@ -185,9 +185,9 @@ target/test-classes/h2/testng.xml - target/test-classes/mysql/testng.xml - target/test-classes/mariadb/testng.xml - target/test-classes/postgres/testng.xml + + + @@ -248,6 +248,11 @@ org.slf4j slf4j-api + + + org.apache.logging.log4j + log4j-to-slf4j + ch.qos.logback diff --git a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java index af8bf12b4..0d410bcbf 100644 --- a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java +++ b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java @@ -700,14 +700,7 @@ protected T processSelectGroup( List functions = cpoClass.getFunctionGroup(Crud.RETRIEVE, groupName).getFunctions(); - localLogger.info( - "=================== Class=<" - + criteriaObj.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(criteriaObj.getClass(), Crud.RETRIEVE, groupName)); try { rObj = (T) bean.getClass().newInstance(); @@ -784,26 +777,11 @@ protected T processSelectGroup( if (!recordsExist) { rObj = null; localLogger.info( - "=================== 0 Records - 0 Attributes - Class=<" - + criteriaObj.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + buildRecordsLogLine(0, 0, criteriaObj.getClass(), Crud.RETRIEVE, groupName)); } else { localLogger.info( - "=================== " - + recordCount - + " Records - " - + attributesSet - + " Attributes - Class=<" - + criteriaObj.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + buildRecordsLogLine( + recordCount, attributesSet, criteriaObj.getClass(), Crud.RETRIEVE, groupName)); } } catch (Throwable t) { String msg = "processSeclectGroup(T bean) failed: " + ExceptionHelper.getLocalizedMessage(t); @@ -891,24 +869,10 @@ protected Stream processSelectGroup( criteriaClass = metaDescriptor.getMetaClass(criteria); resultClass = metaDescriptor.getMetaClass(result); if (useRetrieve) { - localLogger.info( - "=================== Class=<" - + criteria.getClass() - + "> Type=<" - + Crud.RETRIEVE.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(criteria.getClass(), Crud.RETRIEVE, groupName)); cpoFunctions = criteriaClass.getFunctionGroup(Crud.RETRIEVE, groupName).getFunctions(); } else { - localLogger.info( - "=================== Class=<" - + criteria.getClass() - + "> Type=<" - + Crud.LIST.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(criteria.getClass(), Crud.LIST, groupName)); cpoFunctions = criteriaClass.getFunctionGroup(Crud.LIST, groupName).getFunctions(); } @@ -1073,14 +1037,7 @@ protected long processUpdateGroup( cpoClass .getFunctionGroup(adjustCrud(bean, crud, groupName, con), groupName) .getFunctions(); - localLogger.info( - "=================== Class=<" - + bean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(bean.getClass(), crud, groupName)); int numRows = 0; @@ -1093,16 +1050,7 @@ protected long processUpdateGroup( jpsf.release(); ps.close(); } - localLogger.info( - "=================== " - + numRows - + " Updates - Class=<" - + bean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildUpdatesLogLine(numRows, bean.getClass(), crud, groupName)); if (numRows > 0) { updateCount++; @@ -1172,14 +1120,7 @@ protected long processBatchUpdateGroup( // Only Batch if there is only one function if (cpoFunctions.size() == 1) { - localLogger.info( - "=================== BATCH - Class=<" - + firstBean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildBatchLogLine(firstBean.getClass(), crud, groupName)); cpoFunction = cpoFunctions.get(0); jpsf = new JdbcPreparedStatementFactory( @@ -1198,25 +1139,9 @@ protected long processBatchUpdateGroup( updateCount += executeBatch(ps); jpsf.release(); ps.close(); - localLogger.info( - "=================== BATCH - " - + updateCount - + " Updates - Class=<" - + firstBean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildUpdatesLogLine(updateCount, firstBean.getClass(), crud, groupName)); } else { - localLogger.info( - "=================== Class=<" - + firstBean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildCpoClassLogLine(firstBean.getClass(), crud, groupName)); for (T bean : beans) { for (CpoFunction function : cpoFunctions) { jpsf = @@ -1228,16 +1153,7 @@ protected long processBatchUpdateGroup( ps.close(); } } - localLogger.info( - "=================== " - + updateCount - + " Updates - Class=<" - + firstBean.getClass() - + "> Type=<" - + crud.operation - + "> Name=<" - + groupName - + "> ========================="); + localLogger.info(buildUpdatesLogLine(updateCount, firstBean.getClass(), crud, groupName)); } } catch (Throwable t) { diff --git a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAttribute.java b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAttribute.java index b2d5e0af0..ab51196a7 100644 --- a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAttribute.java +++ b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAttribute.java @@ -80,16 +80,6 @@ public String getDbColumn() { return dbColumn_; } - // private void dumpMethod(Method m) { - // logger.debug("========================"); - // logger.debug("===> Declaring Class: " + m.getDeclaringClass().getName()); - // logger.debug("===> Method Signature: " + m.toString()); - // logger.debug("===> Generic Signature: " + m.toGenericString()); - // logger.debug("===> Method isBridge: " + m.isBridge()); - // logger.debug("===> Method isSynthetic: " + m.isSynthetic()); - // logger.debug("========================"); - // } - @Override protected void initTransformClass(CpoMetaDescriptor metaDescriptor) throws CpoException { super.initTransformClass(metaDescriptor); diff --git a/cpo-jdbc/src/test/resources/logback.xml b/cpo-jdbc/src/test/resources/logback.xml index f23d3679c..b4d04d35a 100644 --- a/cpo-jdbc/src/test/resources/logback.xml +++ b/cpo-jdbc/src/test/resources/logback.xml @@ -28,11 +28,12 @@ - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{50} -%kvp- %msg%n - + + diff --git a/pom.xml b/pom.xml index 27e5636c1..2b0b9b710 100644 --- a/pom.xml +++ b/pom.xml @@ -444,6 +444,12 @@ testng 7.11.0 + + + org.apache.logging.log4j + log4j-to-slf4j + 2.25.1 + org.slf4j slf4j-api From 9bdc30287c2faff1674e71022ff335d011f36de0 Mon Sep 17 00:00:00 2001 From: berryware Date: Sat, 6 Dec 2025 06:32:46 -0500 Subject: [PATCH 2/2] updated testcontainers, using the bom properly for versions, oracle still not working --- cpo-cassandra/pom.xml | 4 +--- cpo-jdbc/pom.xml | 27 ++++++++++--------------- cpo-jdbc/src/test/resources/logback.xml | 3 +-- pom.xml | 5 ++--- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/cpo-cassandra/pom.xml b/cpo-cassandra/pom.xml index b2f5a740c..979ffdac8 100644 --- a/cpo-cassandra/pom.xml +++ b/cpo-cassandra/pom.xml @@ -149,13 +149,11 @@ org.testcontainers testcontainers - ${testContainersVersion} test org.testcontainers - cassandra - ${testContainersVersion} + testcontainers-cassandra test diff --git a/cpo-jdbc/pom.xml b/cpo-jdbc/pom.xml index 1b6ed3ab0..eee6f8b4a 100644 --- a/cpo-jdbc/pom.xml +++ b/cpo-jdbc/pom.xml @@ -36,7 +36,7 @@ produces JAVABEANs - 23.26.0.0.0 + 23.26.0.0.0 9.5.0 3.5.6 2.4.240 @@ -94,7 +94,7 @@ oracle - gvenzl/oracle-xe:21.3.0-slim-faststart + gvenzl/oracle-xe:slim-faststart src/test/resources/oracle cpo cpo @@ -185,9 +185,9 @@ target/test-classes/h2/testng.xml - - - + target/test-classes/mysql/testng.xml + target/test-classes/mariadb/testng.xml + target/test-classes/postgres/testng.xml @@ -275,9 +275,9 @@ com.oracle.database.jdbc - ojdbc8 + ojdbc11 ${oracleVersion} - provided + test @@ -338,31 +338,26 @@ org.testcontainers testcontainers - ${testContainersVersion} test org.testcontainers - mysql - ${testContainersVersion} + testcontainers-mysql test org.testcontainers - mariadb - ${testContainersVersion} + testcontainers-mariadb test org.testcontainers - postgresql - ${testContainersVersion} + testcontainers-postgresql test org.testcontainers - oracle-xe - ${testContainersVersion} + testcontainers-oracle-xe test diff --git a/cpo-jdbc/src/test/resources/logback.xml b/cpo-jdbc/src/test/resources/logback.xml index b4d04d35a..f3852de93 100644 --- a/cpo-jdbc/src/test/resources/logback.xml +++ b/cpo-jdbc/src/test/resources/logback.xml @@ -32,8 +32,7 @@ - - + diff --git a/pom.xml b/pom.xml index 2b0b9b710..9a55946c9 100644 --- a/pom.xml +++ b/pom.xml @@ -37,8 +37,7 @@ UTF-8 ${project.version} - 1.21.3 - 2.0.17 + 2.0.17 1.5.20 cpo-github @@ -463,7 +462,7 @@ org.testcontainers testcontainers-bom - ${testContainersVersion} + 2.0.2 pom import