`
小网客
  • 浏览: 1218849 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

android中调试之日志

阅读更多

      开始利用零碎时间做android开发了,android中android.util.Log到底怎么要用呢?跟Java中的日志有什么区别呢?首先看下Log的源码

public final class Log {

    /**
     * Priority constant for the println method; use Log.v.
     */
    public static final int VERBOSE = 2;

    /**
     * Priority constant for the println method; use Log.d.
     */
    public static final int DEBUG = 3;

    /**
     * Priority constant for the println method; use Log.i.
     */
    public static final int INFO = 4;

    /**
     * Priority constant for the println method; use Log.w.
     */
    public static final int WARN = 5;

    /**
     * Priority constant for the println method; use Log.e.
     */
    public static final int ERROR = 6;

    /**
     * Priority constant for the println method.
     */
    public static final int ASSERT = 7;
....................................
}

 发现他共有6种级别,数字大的代表级别高,在代码中可以通过直接写日志的方式在logcat中查看,

5个常用的为Log.v() ,Log.d() ,Log.i() ,Log.w() ,Log.e() 

同时在记录日志的时候注意Log中的一个方法,看源码

   /**
     * Checks to see whether or not a log for the specified tag is loggable at the specified level.
     *
     *  The default level of any tag is set to INFO. This means that any level above and including
     *  INFO will be logged. Before you make any calls to a logging method you should check to see
     *  if your tag should be logged. You can change the default level by setting a system property:
     *      'setprop log.tag.<YOUR_LOG_TAG> <LEVEL>'
     *  Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will
     *  turn off all logging for your tag. You can also create a local.prop file that with the
     *  following in it:
     *      'log.tag.<YOUR_LOG_TAG>=<LEVEL>'
     *  and place that in /data/local.prop.
     *
     * @param tag The tag to check.
     * @param level The level to check.
     * @return Whether or not that this is allowed to be logged.
     * @throws IllegalArgumentException is thrown if the tag.length() > 23.
     */
    public static native boolean isLoggable(String tag, int level);
 具体的使用看doc

 

0
1
分享到:
评论

相关推荐

    android版手机日志程序

    这是简易的android版的手机日志程序

    超实用的android自定义log日志输出工具类

    android自定义log日志输出工具,该工具类具有以下优点: 1 在LogUtlis方法的第一个参数中填this可以输出当前类的名称,特别是在匿名内部类使用也可以输出当前类名。 如 : LogUtils.i(this,”这是一个实用的日志...

    Unity for Android 调试工具(基于UDP)

    通过UDP实时打印Unity 发布Android后的调试日志。里面包含UdpClient 和 UDPServer 只用把UdpClient 挂载在项目里面, 然后启动UdpServer 。 对应好ip和端口号

    android 自定义日志控制类

    android开发 控制日志打印方便调试及日志打开和关闭

    APP测试-Android日志分析

    APP测试-Android日志分析1.日志,又称为 Log,保存的文件称为trace文件,是我们测试人员的又一利器,其实,不管是在调试还是测试的时候,日志都可以帮助我们解决问题。 2.所谓的日志,其实是一种记录机制,允许...

    android日志管理工具类MyLogger

    日志的规范管理,在项目中不容忽视,应用上线后将调试日志关闭也是十分必要的,这是一个好用的日志管理工具类

    android端/手机端日志查看工具

    android端/手机端日志查看工具

    Android应用测试与调试实战

    本书是Android应用测试与调试领域...第二部分为调试技术篇(第12~16章),详细讲解了Android应用调试所需要的各种工具的使用、操作日志的分析、内存日志的分析,以及多线程应用HTML 5 应用和NDK 应用的调试方法和技巧。

    Unity Android平台调试工具

    Unity 里面Android平台调试工具,可以打印出Unity日志文件以及相关的新能信息,直接解压导入Unity即可运行。

    android离线系统日志工具

    由于设备在实际使用过程中可能会遇到各种离线情况,如无法连接到网络或调试服务器、无法访问远程日志系统等,因此Android离线系统日志工具对于开发人员来说非常有用。它们能够提供更全面的日志收集和分析功能,帮助...

    安卓logcat输出内核日志android studio工程源码

    编译该工程源码生成kernellogd程序,通过adb push到手机,然后执行kernellogd 之后,就可以打印输出内核的调试日志信息

    Android 调试桥(adb)使用大全

    Android 调试桥(adb)是多种用途的工具,该工具可以帮助你你管理设备或模拟器 的状态。 可以通过下列几种方法加入adb: • 在设备上运行shell命令 • 通过端口转发来管理模拟器或设备 • 从模拟器或设备上拷贝来或拷贝...

    解决华为系列手机调试时不能打印Logcat日志信息

    解决华为系列手机调试时不能打印Logcat日志信息

    android真机调试时无法显示logcat信息的解决方法介绍

    您可能感兴趣的文章:在Android界面上显示和获取Logcat日志输出的方法Android adb logcat 命令查看日志详细介绍Android shell命令行中过滤adb logcat输出的几种方法Android开发之在程序中时时获取logcat日志信息的...

    安卓调试输出adb日志到文件

    安卓调试,查看日志用

    android调试工具

    android 调试工具,便于用户快速查找软件问题及崩溃日志

    Android调试adb工具

    adb是开发Android应用程序的重要工具,它提供了许多功能来帮助您调试、测试和优化您的应用程序。通过adb,开发人员可以监视应用程序的运行,调试代码,管理设备文件以及执行其他操作。常见的adb命令包括: adb ...

    adb-android调试开发工具

    它可以启用日志记录、跟踪应用程序性能,并在设备上运行调试会话。 启动和停止组件:您可以使用ADB启动或停止Android应用程序的活动、服务、广播接收器等组件。 查看设备信息:ADB提供了命令来查看设备的信息,...

    Android代码-CrashMonitor 监听程序崩溃日志

    MNCrashMonitor 监听程序崩溃日志,直接页面展示崩溃日志列表,调试方便,测试人员可以随时给程序猿查看日志详情,可以动态添加日志内容,手机直接查看日志内容可以分享,复制,生成长截图,高亮显示。 截图 如何添加...

    Unity 查看Android日志

    Unity开发Android 查看日志插件,方便开发。。。。。。。。

Global site tag (gtag.js) - Google Analytics