android log's time-stamp addition

1k Views Asked by At

while looking in android logging frame work - I checked /dev/log/main |system |event log files. in these log file I dont see time stamp. but at the same time "logcat -v time" display time stamp along with log.

I check Logcat code Its reading androidlog_entry from /dev/log/* buffers and displaying on cmdline.

While tracing android logging code , I could not find at what point we are adding timestamp with our log.

I did trace following flow - LOGI("pre_alloc_cap_mem_thread_init: inited=%d", obj->mPreAllocCapMemInited); #define LOGE ALOGE #define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, VA_ARGS)) #define LOG_PRI(priority, tag, ...) \ android_printLog(priority, tag, VA_ARGS) #define android_printLog(prio, tag, fmt...) \ __android_log_print(prio, tag, fmt)

 int __android_log_print(int prio, const char *tag, const char *fmt, ...)
 {
     va_list ap;
     char buf[LOG_BUF_SIZE];

     va_start(ap, fmt);
     vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
     va_end(ap);

     return __android_log_write(prio, tag, buf);
 }

and on and on till NR_writev system call . can somebody please guide me, when Its adding timestamp to android logs.

1

There are 1 best solutions below

0
On BEST ANSWER

I appreciate help.. what ever i could get .. But i have figure out it - "Android frame work does not add time stamp, threadid etc. to android logs that goes to /dev/log/, but It rather pass it down to kernel to logger driver(check logger.c in kernel code) that further add up the timestamp+PID etc. as prefix to each android log. "