In the android source code i see often line like Slog.v(WindowManagerService.TAG, "First window added to " + this + ", creating SurfaceSession");
How can i see those Slog under android monitor ? And what the difference between Slog and Log?
Asked
Active
Viewed 960 times
2

zeus
- 12,173
- 9
- 63
- 184
1 Answers
4
Short answer
You get logs logged with Slog
by default, but they are "hidden" between other log messages. In order to get just the ones logged with Slog
use this command:
adb logcat -b system
Long answer
I looked at source of Slog.java
:
public static int v(String tag, String msg) {
return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg);
}
Compared to Log.java
:
public static int v(String tag, String msg) {
return println_native(LOG_ID_MAIN, VERBOSE, tag, msg);
}
As you can see, the difference is solely in LOG_ID
parameter.
Then I looked at 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.
...
I did not check any further - it looks like a safe bet that -b
option corresponds to different LOG_ID
params.

Vasiliy
- 16,221
- 11
- 71
- 127
-
thanks vasiliy, if i do adb logcat -b system do i will see the log appear in android monitor or just in the windows console ? – zeus Jun 04 '17 at 19:19
-
@loki I always use command line. Maybe there is a way to get it in Android Studio, but I don't know how... – Vasiliy Jun 04 '17 at 19:47