2

I'm using Ormlite library for a android studio project. Many messages are comming from Ormlite on debug mode. It make me can't see other messages. Please help me hide the logs from Ormlite.
Example for a line:

07-28 14:54:55.508  14581-21079/com.paktor I/System.out﹕ 2014-07-28 14:54:55,513 [DEBUG] BaseMappedStatement prepared statement 
Leo Nguyen
  • 614
  • 1
  • 9
  • 23

2 Answers2

2

I'm disabling logging programmatically by using line like:

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

It's working for me because to identify if message should be logged ORMLite firstly trying to get Logger type from by using method:

LoggerFactory.getLogger(Class<?> clazz)

For Android it should return basic Android logger (android.util.Log). But for me it is always returning ORMLite Local logger (com.j256.ormlite.logger.LocalLog). And this logger level is setting up by property LocalLog.LOCAL_LOG_LEVEL_PROPERTY.

If it is not working then it means that ORMLite somehow using Android logging and you just should set level of Android Logger

0

The ORMLite documentation is actually pretty good. If you looked for Android logging in the manual, you would have learned about how to set the logging from the adb shell. You can set the level for all ORMLite messages to WARN to stop the verbosity.

adb shell setprop log.tag.ORMLite WARN

You can also do this programmatically. See the following answer:

How do I enable/disable log levels in Android?

Community
  • 1
  • 1
Gray
  • 115,027
  • 24
  • 293
  • 354
  • 3
    thank you for your answer. but seems there solutions don't work for my device. I tried there ways: in code, I added: System.setProperty("log.tag.ORMLite", "WARN"); and System.setProperty("log.tag.ORMLite", String.value(Log.WARN)); and try run "adb shell setprop log.tag.ORMLite WARN". all of them haven't worked. I still see debug messages from Ormlite – Leo Nguyen Jul 30 '14 at 03:58