Android The log system provides the ability to record and view system debug information. Logs are recorded from a variety of software and some system buffers.
can use adb of the Logcat command to view the contents of the system log buffer, but in the actual operation, you will find the CMD of the DOS interface above, use Logcat Command Direct output of the Chinese content is garbled. such as:
and this problem only appears in the use Logcat print the log directly in the current DOS window will appear while using the Logcat saving the log as a file, and then opening it with the text Editing tool, appears normal.
It's obviously because DOS the encoding of the window display is the same Logcat the different garbled problems caused by the log. the default encoding for DOS windows is GBK, while LogCat prints UTF-8 encoding, so to set the DOS character encoding:
1 . Enter chcp 65001 under the current command line and press ENTER. At this point, the current code page is using UTF-8 encoding.
2, modify the window properties, change the font right-click on the command line title bar, select "Properties", "Font", change the font to True type "Lucida Console", and then click OK to apply the property to the current window.
3, this time again using LOGCAT, the console display Chinese,
Supplementary partial character encoding corresponding code:
65001 -- UTF-8
936 --Simplified Chinese
950 --Traditional Chinese
437 --United States / Canadian English
932 --Japanese
949 --Korean
866 --Russian
Note:
Use of Logcat
[ADB] logcat [<option>] ... [<filter-spec>] ...
Filter statements are described in the following format tag:priority ..., tag is a label, priority is the lowest level of reporting for the label. The priority of the log can be obtained from the above tag. You can write tag:priority multiple times in the filter
ADB logcat tag1:i Tag2:d *:s
The last element of the expression above *:s, is to set all the labels as "silent", all the logs are only shown with "View" and "MyApp", another use of *:s is to be able to ensure that the log output is in accordance with the filter description limit, Also let the filter output to the log as an item.
For example:
[Java]View Plaincopy
- Private static final String TAG = "TEST";
[Java]View Plaincopy
- Date date = New Date (System.currenttimemillis ());
- DateFormat formatter_full = dateformat.getdateinstance (dateformat.full);
- LOG.I (TAG, Formatter_full.format (date));
- DateFormat Formatter_long = dateformat.getdateinstance (Dateformat.long);
- LOG.I (TAG, Formatter_long.format (date));
- DateFormat Formatter_medium = dateformat.getdateinstance (Dateformat.medium);
- LOG.I (TAG, Formatter_medium.format (date));
- DateFormat Formatter_short = dateformat.getdateinstance (Dateformat.short);
- LOG.I (TAG, Formatter_short.format (date));
Then type in cmd: adb logcat test:i *:s
Get
Above partial reprint from: http://blog.sina.com.cn/s/blog_93731f0c0100vz0x.html
The Eclipse installation plugin solves the garbled display in eclipse:
Subsequent: