现在的位置: 首页 > 移动开发 > 正文

Android学习笔记11—_查看与输出日志信息

2019年09月19日 移动开发 ⁄ 共 811字 ⁄ 字号 评论关闭
11_查看与输出日志信息
---------------------------
1.查看日志和错误信息
  因为不会在control控制台输出错误信息,所以要通过
  window-->show view-->logcat显示
---------------------------------------------------------
2.如何输出日志信息
  package com.credream.test;
import android.util.Log;
public class LogTest
{
private static final String TAG="LogTest";
public void testOutLog()throws Throwable{
Log.i(TAG, "www.itdream.com");
}
public void testOutLog2()throws Throwable{
System.out.println("www.credream.com");
}
public void testOutLog3()throws Throwable{
System.err.println("www.mydream.com");
}
}
---------------------------------------------------
选择相应的方法,来右键android junit test就可以了
其中:
System.out.println("www.credream.com");tag为:System.out
System.err.println("www.mydream.com");tag为:System.err
Log.i(TAG, "创梦网络");这时候出现乱码,这是因为不支持,程序是没有问题的
-----------------------------------------------------------------------

抱歉!评论已关闭.