


You should be able to see all the log messages of your application in the Logcat console. Public class LoggingExampleActivity extends AppCompatActivity ) īuild and run your app on a device or an emulator. A third argument, of the class Throwable, which represents an exception or error being thrown.įollowing this, you will learn how to write log messages and check log messages for diagnostic purposes with the help of an example.Ĭreate a new project 2.2 Write Log messagesĪlternatively use alt+enter while hovering over Log method, this will import the Log package.It is the main content of the log message. A TAG can be any string that you find helpful (eg: name of the class). You can define a global static string in the application and hence you can use log filters to limit the log output to specific data. Log.d(String tag, String msg, Throwable tr) (least used as it records more info than usual logging) Log.i display information messages/ expected log messages.

With the help of LOG class you can write your custom log messages in the application.
