I am trying to display long message on logcat. If the length of message is more than 1000 characters, it gets broken.
What is the mechanism to show all characters of long message in logcat?
Verbose: Show all log messages (the default). Debug: Show debug log messages that are useful during development only, as well as the message levels lower in this list. Info: Show expected log messages for regular usage, as well as the message levels lower in this list.
Display a message There are two steps to displaying a message. First, you create a Snackbar object with the message text. Then, you call that object's show() method to display the message to the user.
util. Log is the class that has the methods you want, i.e. Log. i(), Log.
adb logcat –d > filename.txt This command will extract the logcat information from the connected device and redirects the output to a file on the PC. The option –d will take care that the output will stop when all output is flushed.
If logcat is capping the length at 1000 then you can split the string you want to log with String.subString() and log it in pieces. For example:
int maxLogSize = 1000; for(int i = 0; i <= veryLongString.length() / maxLogSize; i++) { int start = i * maxLogSize; int end = (i+1) * maxLogSize; end = end > veryLongString.length() ? veryLongString.length() : end; Log.v(TAG, veryLongString.substring(start, end)); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With