android Sqlite持久层框架 ORMLite日志 在Eclipse中输出

android Sqlite持久层框架 ORMLite日志 在Eclipse中输出

 

这个框架功能相当强大,今天再看官网文档时,发现支持复杂SQL语句,可定义返回对象数组,强大的很还有待进一步研究。

 

 

上一次没有解决此框架下在 Eclipse ADT中logCat输出查询日志的问题,官方已说明,默认是没有打开的,只是把创建表的语句打印出来了,这一点确实,于是今天 再试了下 log4j的配置,仍然不行,再看官方文档:

 

 

4.3 Android Logging 

 

 

The ormlite-android.jar classes define the AndroidLog class which is the Android specific version of ORMLite logging. This class makes calls to the Log.d, Log.i, … methods in the Android API. To see the log output, you will need to use the adb utility to view the log output: 

 

  adb logcat

 

 

Since INFO is the default under Android, only message such as the following will be spit out by default: 

 

  I/TableUtils(  254): creating table 'simpledata'

I/TableUtils(  254): creating index 'simpledata_string_idx' for table

   'simpledata

I/TableUtils(  254): executed create table statement changed 1 rows:

   CREATE TABLE `simpledata` (`date` VARCHAR, `id` INTEGER PRIMARY

   KEY AUTOINCREMENT , `even` SMALLINT )

I/TableUtils(  254): executed create table statement changed 1 rows:

   CREATE INDEX `simpledata_string_idx` ON `simpledata` ( `string` )

 

To enable more debug information you will want to do something like the following to turn on logging for a particular class: 

 

adb shell setprop log.tag.StatementExecutor VERBOSE

adb shell setprop log.tag.BaseMappedStatement VERBOSE

adb shell setprop log.tag.MappedCreate VERBOSE

 

This enables messages such as: 

 

  D/BaseMappedStatement(  465): create object using 'INSERT INTO `simpledata`

   (`date` ,`string` ,`millis` ,`even` ) VALUES (?,?,?,?)' and 4 args,

   changed 1 rows

D/BaseMappedStatement(  465): assigned id '9' from keyholder to 'id' in

   SimpleData object

 

To enable all debug messages for all ORMLite classes then use the following: 

 

  adb shell setprop log.tag.ORMLite DEBUG

 

 

 

还是EN文不是很好的原因,按照说明,运行Eclipse的同时,我打开了adb 控制台,在里面执行上面这一句,搞定.

 



 上面就是我想要的程序运行过程中打印所有SQL语句的内容。

 方便调试

你可能感兴趣的:(android,sqlite,ormlite)