Log Console print settings

Source: Internet
Author: User

Use of the Android Log.isloggable method

The Android dynamic Control logcat Log switch is dynamically controlled via the Log.isloggable (Tag,level) method,
1. Add a log when adding a judgment,
String tag= "Volley";
Boolean isdbug=log.isloggable (TAG, log.verbose);
if (isdbug) {
LOG.W (TAG, "Log");
}
2. Control the log switch by setting the property value.

On PC,cmd-> directory point to Adb.exe (D:\android\adt-bundle-windows-x86-20131030\sdk \platform-tools)->adb Shell SetProp Log.tag.Volley VERBOSE Sets the output level of this tag to VERBOSE. Then log.isloggable ("Volley", log.verbose) level for more than VERBOSE return True, each set once, can only be used for a phone does not restart the situation, if a change or restart to reset it; Self-developed mobile phone set up once, can print verbose, compiled to other mobile phones can not print verbose information, so that you do not have to set the Isdbug to false each time the official release
The value order of the property value is "V,d,i,w,e,a,s" A for the highest level of the log, that is, assert;s represents suppress, which stops the output of the log.

You can also add this property to the Data/local.prop property file, but the difference is that the phone restarts or not, as long as there is local.prop, to print verbose

Log Console print settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.