Davoud
Davoud

Reputation: 2993

Why Log.d and Log.v do not print any output?

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

Upvotes: 0

Views: 6372

Answers (5)

Suzan AK
Suzan AK

Reputation: 1

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.

Upvotes: 0

uptoNoGood
uptoNoGood

Reputation: 586

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.

Upvotes: 10

Mushirih
Mushirih

Reputation: 451

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

Upvotes: 1

Dhanveer thakur
Dhanveer thakur

Reputation: 986

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

Upvotes: -2

VNS
VNS

Reputation: 44

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.

Upvotes: 0

Related Questions