我有一些常规代码:如何禁止groovy DataSet操作的异常日志记录?
def dest = destSql.dataSet('destination_table')
sourceSql.eachRow('select * from source_table'){row ->
try {
dest.add(ID: row.id)
} catch (SQLException) { //A FK constraint will case some inserts to fail
dest.add(ID: 1)
}
}
我跑这是一个命令行脚本。一切正常,但无论如何,控制台都会输出SQLException。我希望他们在处理它们时不要出现,因为它们只会污染输出。我怎么能指定(如果可能,以编程方式)?
TIA。
完美,正是我所期待的。谢谢。 – Andrei 2010-10-06 12:32:01