feelwing1314 commented on issue #1818: when the Logic SQL is very long, SQLLogger print too much. if the Logic SQL is Cross-sharding,that's worse URL: https://github.com/apache/incubator-shardingsphere/issues/1818#issuecomment-459591864 ``` public static void logSQL(final String logicSQL, final SQLStatement sqlStatement, final Collection<RouteUnit> routeUnits) { log("Rule Type: sharding : v2 "); if (!sqlLogSimple) { log("Logic SQL: {}", logicSQL); log("SQLStatement: {}", sqlStatement); for (RouteUnit each : routeUnits) { if (each.getSqlUnit().getParameterSets().get(0).isEmpty()) { log("Actual SQL: {} ::: {}", each.getDataSourceName(), each.getSqlUnit().getSql()); } else { log("Actual SQL: {} ::: {} ::: {}", each.getDataSourceName(), each.getSqlUnit().getSql(), each.getSqlUnit().getParameterSets()); } } }else{ log("Logic SQL(simple): {}", logicSQL.length()>512?logicSQL.substring(0, 512):logicSQL); Set<String> dataSourceNames = new HashSet<>(routeUnits.size()); for (RouteUnit each : routeUnits) { dataSourceNames.add(each.getDataSourceName()); } log("Actual SQL(simple): {} ::: {}", dataSourceNames, routeUnits.size()); } } ``` and the simple log output like this (the imagesub_fenbiao have 127 actual sql, id is sharding column): 2019-02-01 11:20:19.259 [main] INFO ShardingSphere-SQL: Rule Type: sharding 2019-02-01 11:20:19.261 [main] INFO ShardingSphere-SQL: Logic SQL(simple): select * from imagesub_fenbiao where image_no=? 2019-02-01 11:20:19.262 [main] INFO ShardingSphere-SQL: Actual SQL(simple): [yyfax_afei] ::: 127
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
