diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java index b9a22a1ef75962159bd33a8e525898a69b67a911..4dc49fd37b1b5092b6799ec67bebd680f9642379 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java @@ -19,14 +19,13 @@ import java.util.Map; public class TaosDemoApplication { - private static Logger logger = Logger.getLogger(TaosDemoApplication.class); + private static final Logger logger = Logger.getLogger(TaosDemoApplication.class); public static void main(String[] args) throws IOException { // 读配置参数 JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args); boolean isHelp = Arrays.asList(args).contains("--help"); if (isHelp || config.host == null || config.host.isEmpty()) { -// if (isHelp) { JdbcTaosdemoConfig.printHelp(); System.exit(0); } @@ -75,7 +74,7 @@ public class TaosDemoApplication { } } end = System.currentTimeMillis(); - logger.error(">>> create table time cost : " + (end - start) + " ms."); + logger.info(">>> create table time cost : " + (end - start) + " ms."); /**********************************************************************************/ // 插入 long tableSize = config.numOfTables; @@ -90,7 +89,7 @@ public class TaosDemoApplication { // multi threads to insert int affectedRows = subTableService.insertMultiThreads(superTableMeta, threadSize, tableSize, startTime, gap, config); end = System.currentTimeMillis(); - logger.error("insert " + affectedRows + " rows, time cost: " + (end - start) + " ms"); + logger.info("insert " + affectedRows + " rows, time cost: " + (end - start) + " ms"); /**********************************************************************************/ // 删除表 if (config.dropTable) { @@ -108,5 +107,4 @@ public class TaosDemoApplication { return startTime; } - } diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/DatabaseMapperImpl.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/DatabaseMapperImpl.java index 69bae160f6285bb9d1a94357cc2279ebfca22eca..421a2dea1f4b49786d57b5579ca849976708791e 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/DatabaseMapperImpl.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/DatabaseMapperImpl.java @@ -21,27 +21,27 @@ public class DatabaseMapperImpl implements DatabaseMapper { public void createDatabase(String dbname) { String sql = "create database if not exists " + dbname; jdbcTemplate.execute(sql); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); } @Override public void dropDatabase(String dbname) { String sql = "drop database if exists " + dbname; jdbcTemplate.update(sql); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); } @Override public void createDatabaseWithParameters(Map map) { String sql = SqlSpeller.createDatabase(map); jdbcTemplate.execute(sql); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); } @Override public void useDatabase(String dbname) { String sql = "use " + dbname; jdbcTemplate.execute(sql); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); } } diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapperImpl.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapperImpl.java index e3a6691430f8b5232660ed6edeab01318db30ef1..90b0990a2bf2e9a9bd2738deec17a284c0868280 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapperImpl.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapperImpl.java @@ -21,14 +21,14 @@ public class SubTableMapperImpl implements SubTableMapper { @Override public void createUsingSuperTable(SubTableMeta subTableMeta) { String sql = SqlSpeller.createTableUsingSuperTable(subTableMeta); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); jdbcTemplate.execute(sql); } @Override public int insertOneTableMultiValues(SubTableValue subTableValue) { String sql = SqlSpeller.insertOneTableMultiValues(subTableValue); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); int affectRows = 0; try { @@ -42,7 +42,7 @@ public class SubTableMapperImpl implements SubTableMapper { @Override public int insertOneTableMultiValuesUsingSuperTable(SubTableValue subTableValue) { String sql = SqlSpeller.insertOneTableMultiValuesUsingSuperTable(subTableValue); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); int affectRows = 0; try { @@ -56,7 +56,7 @@ public class SubTableMapperImpl implements SubTableMapper { @Override public int insertMultiTableMultiValues(List tables) { String sql = SqlSpeller.insertMultiSubTableMultiValues(tables); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); int affectRows = 0; try { affectRows = jdbcTemplate.update(sql); @@ -69,7 +69,7 @@ public class SubTableMapperImpl implements SubTableMapper { @Override public int insertMultiTableMultiValuesUsingSuperTable(List tables) { String sql = SqlSpeller.insertMultiTableMultiValuesUsingSuperTable(tables); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); int affectRows = 0; try { affectRows = jdbcTemplate.update(sql); diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapperImpl.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapperImpl.java index a293de5100d9af33bc88ad5f02ae632333a5b5b8..efa9a1f39ea41dd1aba65ab610eae095a3164533 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapperImpl.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapperImpl.java @@ -18,14 +18,14 @@ public class SuperTableMapperImpl implements SuperTableMapper { @Override public void createSuperTable(SuperTableMeta tableMetadata) { String sql = SqlSpeller.createSuperTable(tableMetadata); - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); jdbcTemplate.execute(sql); } @Override public void dropSuperTable(String database, String name) { String sql = "drop table if exists " + database + "." + name; - logger.info("SQL >>> " + sql); + logger.debug("SQL >>> " + sql); jdbcTemplate.execute(sql); } } diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapperImpl.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapperImpl.java index 77415619f02a1a0650448e9a8856fcb8d33e4921..b049fbe197034ffcd8801b9c4f5e5ff8dbbcc0e0 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapperImpl.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapperImpl.java @@ -1,43 +1,49 @@ package com.taosdata.taosdemo.dao; -import com.taosdata.taosdemo.dao.TableMapper; import com.taosdata.taosdemo.domain.TableMeta; import com.taosdata.taosdemo.domain.TableValue; import com.taosdata.taosdemo.utils.SqlSpeller; +import org.apache.log4j.Logger; import org.springframework.jdbc.core.JdbcTemplate; import java.util.List; public class TableMapperImpl implements TableMapper { + private static final Logger logger = Logger.getLogger(TableMapperImpl.class); private JdbcTemplate template; @Override public void create(TableMeta tableMeta) { String sql = SqlSpeller.createTable(tableMeta); + logger.debug("SQL >>> " + sql); template.execute(sql); } @Override public int insertOneTableMultiValues(TableValue values) { String sql = SqlSpeller.insertOneTableMultiValues(values); + logger.debug("SQL >>> " + sql); return template.update(sql); } @Override public int insertOneTableMultiValuesWithColumns(TableValue values) { String sql = SqlSpeller.insertOneTableMultiValuesWithColumns(values); + logger.debug("SQL >>> " + sql); return template.update(sql); } @Override public int insertMultiTableMultiValues(List tables) { String sql = SqlSpeller.insertMultiTableMultiValues(tables); + logger.debug("SQL >>> " + sql); return template.update(sql); } @Override public int insertMultiTableMultiValuesWithColumns(List tables) { String sql = SqlSpeller.insertMultiTableMultiValuesWithColumns(tables); + logger.debug("SQL >>> " + sql); return template.update(sql); } } diff --git a/tests/examples/JDBC/taosdemo/src/main/resources/log4j.properties b/tests/examples/JDBC/taosdemo/src/main/resources/log4j.properties index b2a9586ea78e2d55a0091097097988b038267405..352545854d0f68f07e4da6a98504ffa7754b03b1 100644 --- a/tests/examples/JDBC/taosdemo/src/main/resources/log4j.properties +++ b/tests/examples/JDBC/taosdemo/src/main/resources/log4j.properties @@ -1,5 +1,5 @@ ### 设置### -log4j.rootLogger=error,stdout +log4j.rootLogger=info,stdout ### 输出信息到控制抬 ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out