androidlogginglogcatlogbackormlite

Decrease ORMlite's internal log verbosity or disable it


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:

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

ORMLite method tracing

Any thoughts on how to handle this out?


Solution

  • With method tracing we saw that LocalLog was being used. As is stated on LocalLog's documentation:

    You can set the log level by setting the System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "trace").
    Acceptable values are: TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.

    We couldn't set the property using adb shell so we added the following line to our Application.onCreate

    System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR");
    

    Finally we stop seeing ORMLite output on logcat and performance increased as expected.