I'm working on building an Android app and I'm wondering what the best approach is to debugging like that of console.log in javascript
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
The Log class:
Outside of Android,
System.out.println(String msg)
is used.Use the Android logging utility.
http://developer.android.com/reference/android/util/Log.html
Log has a bunch of static methods for accessing the different log levels. The common thread is that they always accept at least a tag and a log message.
Tags are a way of filtering output in your log messages. You can use them to wade through the thousands of log messages you'll see and find the ones you're specifically looking for.
You use the Log functions in Android by accessing the Log.x objects (where the x method is the log level). For example:
I usually make it a point to make the tag my class name so I know where the log message was generated too. Saves a lot of time later on in the game.
You can see your log messages using the logcat tool for android:
Or by opening the eclipse Logcat view by going to the menu bar
console.log()
in java isSystem.out.println();
to put text on the next lineAnd
System.out.print();
puts text on the same line.