Skip to content

Commit 5b216cb

Browse files
committed
CDAP-20472: Fix missing logging for exceptions
1 parent ccd12fc commit 5b216cb

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

delta-plugins-common/src/main/java/io/cdap/delta/plugin/common/DriverCleanup.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ public static DriverCleanup ensureJDBCDriverIsAvailable(Class<? extends Driver>
5656
DriverManager.getDriver(url);
5757
return new DriverCleanup(null);
5858
} catch (SQLException e) {
59+
LOG.warn("Error while getting JDBC Driver from URL {}", url, e);
5960
Driver driver = classz.newInstance();
6061
JDBCDriverShim shim = new JDBCDriverShim(driver);
6162
try {
6263
deregisterAllDrivers(classz);
6364
} catch (NoSuchFieldException | ClassNotFoundException e1) {
64-
LOG.warn("Unable to deregister JDBC Driver class {}", classz);
65+
LOG.warn("Unable to deregister JDBC Driver class {} {}", classz, e1.getMessage());
6566
}
6667
DriverManager.registerDriver(shim);
6768
return new DriverCleanup(shim);

mysql-delta-plugins/src/main/java/io/cdap/delta/mysql/MySqlTableAssessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import io.cdap.delta.api.assessment.TableDetail;
2929
import io.cdap.delta.plugin.common.ColumnEvaluation;
3030
import io.cdap.delta.plugin.common.DriverCleanup;
31+
import org.slf4j.Logger;
32+
import org.slf4j.LoggerFactory;
3133

3234
import java.io.IOException;
3335
import java.sql.Connection;
@@ -44,6 +46,7 @@
4446
* MySQL table assessor.
4547
*/
4648
public class MySqlTableAssessor implements TableAssessor<TableDetail> {
49+
private static final Logger LOG = LoggerFactory.getLogger(MySqlTableAssessor.class);
4750
static final String COLUMN_LENGTH = "COLUMN_LENGTH";
4851
static final String SCALE = "SCALE";
4952

@@ -197,6 +200,7 @@ private void checkReplicationPermissions(List<Problem> featureProblems, List<Str
197200
}
198201
}
199202
} catch (Exception e) {
203+
LOG.error("Error in checking permissions", e);
200204
featureProblems.add(permissionUnknownProblem);
201205
}
202206
}

sqlserver-delta-plugins/src/main/java/io/cdap/delta/sqlserver/SqlServerTableRegistry.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ public TableDetail describeTable(String db, @Nullable String schema, String tabl
134134
}
135135
}
136136
} catch (Exception e) {
137+
String msg = String.format("Unable to check if CDC feature for table '%s' in database '%s' was enabled or not",
138+
schema == null ? table : schema + "." + table, db);
139+
LOGGER.error(msg, e);
137140
missingFeatures.add(
138-
new Problem("Unable To Check If CDC Was Enabled",
139-
String.format("Unable to check if CDC feature for table '%s' in database '%s' was enabled or not",
140-
schema == null ? table : schema + "." + table, db),
141-
"Check database connectivity and table information",
142-
null));
141+
new Problem("Unable To Check If CDC Was Enabled", msg,
142+
"Check database connectivity and table information", null));
143143
}
144144
return builder.setFeatures(missingFeatures).build();
145145
} catch (SQLException e) {

0 commit comments

Comments
 (0)