12

Is there any way to make greendao spit queries that're being carried out into Logcat? I just want to reassure everything's working fine and it would be a good feature to have while getting accustomed to the system.

midnight
  • 3,420
  • 3
  • 36
  • 58

2 Answers2

15

The class QueryBuilder has a static flag for this:

/** Set to true to debug the SQL. */
public static boolean LOG_SQL;

So just set *QueryBuilder.LOG_SQL = true*, and you should get what you want.

Markus Junginger
  • 6,950
  • 31
  • 52
  • does it work for all queries? because when I set it like `QueryBuilder.LOG_SQL = true; scheduleDao.queryBuilder().LOG_SQL = true; scheduleDao.insertOrReplaceInTx(dbSchedules); ` it doesn't make any difference – midnight Jan 29 '13 at 11:34
  • No, it's just for queries. – Markus Junginger Jan 29 '13 at 20:27
  • does it work only on a real device? Because I've tried it on the Android Simulator but it does not log anything – Ale Jan 25 '16 at 08:53
4
            dao.queryBuilder().LOG_VALUES=true; (For values)
            dao.queryBuilder().LOG_SQL=true;     (For query)
kukku
  • 489
  • 5
  • 17