1

In my build.gradle , the logcat is visible when

debugCompile 'org.slf4j:slf4j-android:1.6.1-RC1'

However when the version is updated , there is logcat

debugCompile 'org.slf4j:slf4j-android:1.7.14'

I am stuck with 1.6.1-RC1 version. Why the newer versions of slf4j-android:1.7.x are not logged in the logcat ?

I use SLF4J in the code like this

private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(TAG);
LOG.debug("variable = {}", var);

References

http://www.slf4j.org/android/

http://www.slf4j.org/news.html ( changelog )

Raymond Chenon
  • 11,482
  • 15
  • 77
  • 110

2 Answers2

1

http://jira.qos.ch/browse/SLF4J-314 gave me the answer .

To see the logs on "slf4j-android:1.7.x" , using Android setprop is the official approach. The downside of this approach is that you have to select the TAG but cannot show all logs . For example in the logcat :

app_package D/TAG1: blabla
app_package D/TAG2: lorem ipsum

In the terminal , enter

adb shell setprop log.tag.TAG1 VERBOSE

I will only display TAG1 and no the others TAGs . I wonder if it is possible to print all other Tags.

For now , I think I will stick with 1.6.1-RC1 version

Raymond Chenon
  • 11,482
  • 15
  • 77
  • 110
0

i just looked at the source code of AndroidLoggerAdapter.java The code 1.7.+ now uses if isLoggable(priority) before every logging statement while the 1.6.+ just logged without asking.

It is an android default feature that if (Log.isLoggable("MY_TAG", Log.VERBOSE)) always return false while Log.v("MY_TAG", "Here's a log message") still works

This explains why org.slf4j:slf4j-android:1.7.14 does not work anymore.

Maybe this helps to cope with the new version: Android logging levels

I am using http://github.com/lp0/slf4j-android an alternative implementation that uses a config file to enable/disable config settings

Community
  • 1
  • 1
k3b
  • 14,517
  • 7
  • 53
  • 85