0

i have the following issue programming an android application with android studio. When I use Log.d(...) in the code, no logging output is generated while all other logging functions, e.g. Log.i(...), work in exactly the same position.

Example that does not work:

 @Override
 protected void onStart() {
    super.onStart();
    Log.d("MainActivity", "onStart called.");
 }

But this works:

@Override
protected void onStart() {
    super.onStart();
    Log.i("MainActivity", "onStart called.");
}

The Logcat level is set to Debug, the correct device and application are chosen, and as filter I use the Tag "MainActivity". I have already tried to restart logcat, clear the log, nothing successful.

I have also that the logging level with adb shell setprop log.tag.MainActivity DEBUG so that Log.isLoggable("MainActivity", Log.DEBUG) returns true.

The App is also set to debuggable.

I am very thankful for any hint.

EDIT: I seems to be an issue with my phone (Honor8). Although it hasn't worked in the emulator as well, executing adb shell setprop log.tag.MainActivity DEBUG fixes the problem at least in the emulator.

xrockx
  • 57
  • 7

1 Answers1

1

I solved the problem:

  1. For the emulator devices, executing adb shell setprop log.tag.MainActivity DEBUG in terminal did the job.

  2. For my Honor 8, had additionally to dial *#*#2846579#*#* and tick all logging properties, as described here: Huawei, logcat not showing the log for my app?

Community
  • 1
  • 1
xrockx
  • 57
  • 7