What is console.log () java?

I am working on creating an Android application and I am wondering what is best suited for debugging, for example for console.log in javascript

+44
java android
Nov 18 2018-11-11T00:
source share
2 answers

Log Class:

API for sending log output.

Typically, use the Log.v() Log.d() Log.i() Log.w() and Log.e() Methods.

The order in terms of verbosity, from smallest to largest, is ERROR , WARN , INFO , DEBUG , VERBOSE . Detailed information should never be compiled unless it is being developed. Debug logs compiled into stripped at runtime. Error, warning and information logs are always kept.

Outside of Android, System.out.println(String msg) .

+58
Nov 18 '11 at 0:20
source share

Use the Android logging utility.

http://developer.android.com/reference/android/util/Log.html

The log has a bunch of static methods for accessing different levels of the log. A common thread is that they always accept at least a tag and a log message.

Tags are a way to filter the output in your log messages. You can use them to make your way through the thousands of log messages that you see and find the ones you are specifically looking for.

You use the log features in Android by accessing Log.x objects (where method x is the log level). For example:

 Log.d("MyTagGoesHere", "This is my log message at the debug level here"); Log.e("MyTagGoesHere", "This is my log message at the error level here"); 

I usually do this to make the tag my class name so that I know where the log message was created. Saves a lot of time later in the game.

You can view your log messages using the logcat tool for Android:

 adb logcat 

Or by opening the Logcat eclipse view by going to the menu bar

 Window->Show View->Other then select the Android menu and the LogCat view 
+14
Nov 18 2018-11-11T00:
source share



All Articles