Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

分库分表时RouterResult不是SingleTarget的情况下希望也打印路由出来的db和sql debug日志,方便调试 #49

Open
tensorZhang opened this issue Sep 4, 2020 · 0 comments

Comments

@tensorZhang
Copy link

com.dianping.zebra.shard.jdbc.ShardStatement#executeQueryByOriginal
此方法中isSingleTarget(routerTarget)情况下打印了db,sql日志;希望else情况下也将db、sql日志打印出来。谢谢!

if (LOGGER.isDebugEnabled()) {
						LOGGER.debug("db:" + targetedSql.getDatabaseName());
						LOGGER.debug("sql:" + executableSql);
					}
if (isSingleTarget(routerTarget)) {
			// if has only one sql,then serial execute it
			for (RouterTarget targetedSql : routerTarget.getSqls()) {
				for (String executableSql : targetedSql.getSqls()) {
					if (LOGGER.isDebugEnabled()) {
						LOGGER.debug("db:" + targetedSql.getDatabaseName());
						LOGGER.debug("sql:" + executableSql);
					}

					Connection conn = connection.getRealConnection(targetedSql.getDatabaseName(), autoCommit);
					Statement stmt = createStatement(conn);
					actualStatements.add(stmt);

					resultList.add(stmt.executeQuery(executableSql));
				}
			}
		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant