Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android difference between slog vs androi.util.log logging

Tags:

android

In my Android app, I am trying to implement logger. While doing so I see Android packages use slog, and I see there is Log under android.util package, which is being used widely in the application, see below code:

Slog

 Slog.v(TAG, "onCreate " + this + ": " + savedInstanceState)

Log

Log.v(TAG, e.printStackTrace())

what is difference between the above logs.

like image 568
pappu_kutty Avatar asked Aug 28 '26 22:08

pappu_kutty


1 Answers

For future readers of this post, Slog is simply a wrapper over the standard android.util.Log which logs its output under the Log.LOG_ID_SYSTEM id.

There are five different IDs under which the logs are categorized and those are:

  • LOG_ID_MAIN: For the main buffer under which all common application logs go.

  • LOG_ID_SYSTEM: For the system log buffer where all system services logs.

  • LOG_ID_RADIO: For logging radio-related events.

  • LOG_ID_EVENTS: For logging system and sensor events.

  • LOG_ID_CRASH: For logging crashes and wtf failures

Android Logging

Image source: https://elinux.org/Android_Logging_System

like image 160
riyaz-ali Avatar answered Aug 30 '26 12:08

riyaz-ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!