javaandroid

Log.d not showing log.d in Logcat Android Studio


Android studio does not show any Logs I wrote in my code. I have tried putting the log to verbose and debug. I am using 'No filters'. Why is 'Oncreatetestlog' not showing up in my logcat?

package com.example.keydown;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (savedInstanceState != null) {
            Log.d("Oncreatetestlog", "onCreate() Restoring previous state");
            /* restore state */
        } else {
            Log.d("Oncreatetestlog2", "onCreate() No saved state available");
            /* initialize app */
        }
    }
}

Solution

  • After hours of searching and trying, I found out it did not have to do with Android Studio, but that my phone didn't allow Logging. See this answer for more information.