当标签以“IMS"开头时,为什么Logcat不打印日志? [英] Why does Logcat not print a log when the tag starts with "IMS"?

查看:26
本文介绍了当标签以“IMS"开头时,为什么Logcat不打印日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Logcat以IMS"开头时Logcat不打印日志?

Why does Logcat not print a log when the tag starts with "IMS"?

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btnOne:
            System.out.println("Button One log by sout");
            Log.e("IMSfsadfasdfasdf", "log by Log.e()");
            break;
        case R.id.btnTwo:
            System.out.println("Button Two log by sout");
            Log.e("MService", "log by Log.e()");
            break;
    }
}

日志:

04-07 15:05:48.838 4363-4363/com.licheedev.myapplication I/System.out: Button One log by sout
04-07 15:05:49.916 4363-4363/com.licheedev.myapplication I/System.out: Button Two log by sout
04-07 15:05:49.916 4363-4363/com.licheedev.myapplication E/MService: log by Log.e()
04-07 15:05:54.109 4363-4363/com.licheedev.myapplication I/System.out: Button Two log by sout
04-07 15:05:54.109 4363-4363/com.licheedev.myapplication E/MService: log by Log.e()
04-07 15:05:54.822 4363-4363/com.licheedev.myapplication I/System.out: Button One log by sout
04-07 15:05:55.638 4363-4363/com.licheedev.myapplication I/System.out: Button One log by sout

截图:

推荐答案

我不是很确定,但我认为这与 Android 的日志机制中的这行代码有关.这是在函数 __android_log_write(prio, tag, buf);

I'm not exactly sure, but I think this have to do with this line of code in the log mechanism of Android. This is in the function __android_log_write(prio, tag, buf);

/* XXX: This needs to go! */
if (!strcmp(tag, "HTC_RIL") ||
    !strncmp(tag, "RIL", 3) || /* Any log tag with "RIL" as the prefix */
    !strncmp(tag, "IMS", 3) || /* Any log tag with "IMS" as the prefix */
    !strcmp(tag, "AT") ||
    !strcmp(tag, "GSM") ||
    !strcmp(tag, "STK") ||
    !strcmp(tag, "CDMA") ||
    !strcmp(tag, "PHONE") ||
    !strcmp(tag, "SMS")) {
        log_id = LOG_ID_RADIO;
        // Inform third party apps/ril/radio.. to use Rlog or RLOG
        snprintf(tmp_tag, sizeof(tmp_tag), "use-Rlog/RLOG-%s", tag);
        tag = tmp_tag;
}

阅读此博客帖子了解详细信息.

Read this blog post for detailed information.

这篇关于当标签以“IMS"开头时,为什么Logcat不打印日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆