One of the most useful techniques when debugging and / or tracking applications on any platform is the creation of execution logs. Android of course is not far behind and also provides us with its own service and logging API through the class android.util.Log.
In Android, all log messages will be associated with the following information:
Date / Time of the message.
Criticity Level of message severity (detailed below).
PID Internal code of the process that has entered the message.
Tag. Identification label of the message (it is detailed later).
Message. The full text of the message.
Similar to what happens with other logging frameworks, in Android the log messages will be classified by their criticality, thus existing several categories (ordered from highest to lowest criticality):
Error
Warning
Info
Debug
Verbose
For each of these message types, there is an independent static method that allows adding it to the application's log. Thus, for each of the previous categories we have available the methods e (), w (), i (), d () and v () respectively.
public class LogsAndroid extends Activity {
private static final String LOGTAG = "LogsAndroid";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.e(LOGTAG, "Mensaje de error");
Log.w(LOGTAG, "Mensaje de warning");
Log.i(LOGTAG, "Mensaje de información");
Log.d(LOGTAG, "Mensaje de depuración");
Log.v(LOGTAG, "Mensaje de verbose");
}
}
I got the information from the following link:
link
I hope it serves you. Greetings.