We're doing some heavy performance tuning in our app, hence we start using method tracing to find the bottlenecks.
At first glance Ormlite was fine, but we found that for example in one query that takes 8ms, 6ms (75%) were needed by Ormlite's internal log. Futhermore those log call are in DEBUG level.
At the moment I have tried (without success) setting log level to ERROR this way:
- with adb:
adb shell setprop log.tag.ORMLite ERROR
- with logback:
<logger name="com.j256.ormlite" level="ERROR"/>
This are a few lines from the logcat
I/System.out( 4207): 2014-10-01 10:50:14,702 [DEBUG] BaseMappedStatement query-for-id using ...
I/System.out( 4207): 2014-10-01 10:50:14,706 [DEBUG] StatementExecutor executing raw query for ...
I/System.out( 4207): 2014-10-01 10:50:14,709 [DEBUG] SelectIterator starting iterator @-1593957304 for ...
I/System.out( 4207): 2014-10-01 10:50:14,711 [DEBUG] SelectIterator closed iterator @-1593957304 after 1 rows
I/System.out( 4207): 2014-10-01 10:50:14,714 [DEBUG] BaseMappedStatement query-for-id using ...
I/System.out( 4207): 2014-10-01 10:50:14,717 [DEBUG] BaseMappedStatement query-for-id using ...
I/System.out( 4207): 2014-10-01 10:50:14,718 [DEBUG] StatementBuilder built statement ...
I/System.out( 4207): 2014-10-01 10:50:14,719 [DEBUG] BaseMappedStatement prepared statement ...
Here is a screnshot of method tracing
Any thoughts on how to handle this out?
With method tracing we saw that LocalLog was being used. As is stated on LocalLog's documentation:
We couldn't set the property using
adb shell
so we added the following line to ourApplication.onCreate
Finally we stop seeing ORMLite output on logcat and performance increased as expected.
For me I used ORMLite in my project (not with android). there I used the logback.xml to configure it.
http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_5.html
So we can simply use logback.xml as bellow.