我在哪里可以打印日志以便在 Android Studio 中立即查看?
Where can I print out logs to see immediately in Android Studio?
我正在使用 Android studio,我想将错误和警告打印到控制台之类的地方进行调试。
我怎样才能做到这一点?
我知道Logcat,但是日志总是满满的,我找不到我的。
Logcat 是要走的路。可以仅根据来自您的应用程序的输出或特定标记来过滤 logcat,以便更轻松地查看您想要的输出。
在此处查看有关如何在 Android Studio 中过滤 logcat 的详细信息:
How to filter logcat in Android Studio?
使用错误日志打印堆栈跟踪。错误日志的消息较少,您可以轻松找到您的消息。如果您使用 try/catch 块:
try
{
//your code
}
catch(Exception e)
{
Log.e("error tag", Log.getStackTraceString(e));
}
我正在使用 Android studio,我想将错误和警告打印到控制台之类的地方进行调试。 我怎样才能做到这一点? 我知道Logcat,但是日志总是满满的,我找不到我的。
Logcat 是要走的路。可以仅根据来自您的应用程序的输出或特定标记来过滤 logcat,以便更轻松地查看您想要的输出。
在此处查看有关如何在 Android Studio 中过滤 logcat 的详细信息:
How to filter logcat in Android Studio?
使用错误日志打印堆栈跟踪。错误日志的消息较少,您可以轻松找到您的消息。如果您使用 try/catch 块:
try
{
//your code
}
catch(Exception e)
{
Log.e("error tag", Log.getStackTraceString(e));
}