0

Want to Log something with Log.d, but no output text is appearing in the Android Monitor section. Code is like below?

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    insertToDb();
}

private void insertToDb() {
 Log.d("TAG", "Rows count: ");

    }

After restarting nothing changed also:

enter image description here

Davoud
  • 2,576
  • 1
  • 32
  • 53

5 Answers5

10

This might help
Huawei, logcat not showing the log for my app?

Dial

*#*#2846579#*#*

and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).

You might have to enable both AP and CP logs for debug and verbose logs to show.

PS : probably only for Huawei devices.

Pang
  • 9,564
  • 146
  • 81
  • 122
uptoNoGood
  • 566
  • 5
  • 20
1

Use

Log.e("TAG", "Rows count: ");

For the log to be in red (error) for better visibility.Remember to clear the search bar of the logs pane to display all logs too

Mushirih
  • 451
  • 5
  • 13
0

It is working. i had tried. but if it is not working in your android studio then check you had selected your device properly or else try to restart the android studio.

VNS
  • 44
  • 8
0

Its working fine... you need to check log under Debug section as you have used Log.d.

Dhanveer thakur
  • 902
  • 1
  • 9
  • 17
0

I had this problem as well. At first, I was importing Log using this:

import com.example.android.common.logger.Log;

When I imported Log using this:

import android.util.Log;

the output appeared.

Suzan AK
  • 1
  • 3