2
在Android源代码中,我经常看到像Slog.v(WindowManagerService.TAG, "First window added to " + this + ", creating SurfaceSession");
这样的行我怎么能看到那些Slog在android监视器下? Slog和Log之间有什么区别?是否有可能在android监视器中读取Slog?
在Android源代码中,我经常看到像Slog.v(WindowManagerService.TAG, "First window added to " + this + ", creating SurfaceSession");
这样的行我怎么能看到那些Slog在android监视器下? Slog和Log之间有什么区别?是否有可能在android监视器中读取Slog?
简短的回答
你获得与登录由Slog
默认的日志,但他们有其他的日志信息之间的“隐藏”。为了得到记录与Slog
使用只是那些命令:
adb logcat -b system
龙答案
我看着Slog.java
来源:
public static int v(String tag, String msg) {
return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg);
}
相比Log.java
:
public static int v(String tag, String msg) {
return println_native(LOG_ID_MAIN, VERBOSE, tag, msg);
}
如您所见,差异仅在LOG_ID
参数中。
然后我看着adb logcat -help
:
...
-b <buffer> Request alternate ring buffer, 'main', 'system', 'radio',
'events', 'crash' or 'all'. Multiple -b parameters are
allowed and results are interleaved. The default is
-b main -b system -b crash.
...
我没有任何进一步的检查 - 它看起来像-b
选项对应于不同LOG_ID
PARAMS一个安全的赌注。
感谢vasiliy,如果我做adb logcat -b系统我会看到日志显示在Android监视器或只是在Windows控制台? – loki
@loki我总是使用命令行。也许有一种方法可以在Android Studio中获得它,但我不知道如何... – Vasiliy