Android AOSP linux 服务标准输出

Android AOSP linux service standard output

我正在为 android 图片开发我自己的看门狗 linux 服务 (init.rc) 我正在烹饪。

这些 linux 服务使用一些日志库,例如 log.h 来显示此类服务的输出。我试图跟踪这些库,以便找到日志输出的转储位置。

我在 android logcat 和 /proc/kmsg 或 dmesg

中都没有找到任何东西

这是在 init.rc 中启动的 linux 服务的 log.h 库:

#ifndef _INIT_LOG_H_
#define _INIT_LOG_H_

#include <cutils/klog.h>

#define ERROR(x...)   KLOG_ERROR("init", x)
#define NOTICE(x...)  KLOG_NOTICE("init", x)
#define INFO(x...)    KLOG_INFO("init", x)

#define LOG_UEVENTS        0  /* log uevent messages if 1. verbose */

#endif

这是使用此类库的示例

INFO("Starting watchdogd\n");

要在 init.rc 中显示您的服务日志,您可以使用 /system/bin/logwrapper 例子 服务 xupnpdx /system/bin/logwrapper /system/bin/xupnpdservice