how can i save the logcat from booting time??

2,999 views
Skip to first unread message

김우경

unread,
Jan 20, 2011, 1:43:50 AM1/20/11
to android-...@googlegroups.com
HI~

first my english is too bad.. so plz understand my wrong english..

anyway.. i want to make the log system using a logcat..

i see the log via logcat(in emulator)

i will make the log system like a logcat.

1) logcat shows a android logs..
2) i will save the logs to the file like a web server log file(like a using log4j)
3) i will contol the log level via application.(is that possible that modified init.rc ?)
4) if i modified init.rc file then it adapted system??(init.rc file got a loglevel 3 what it means??)

how can i save the log file from booting time??

김태연

unread,
Jan 20, 2011, 12:10:07 PM1/20/11
to android-...@googlegroups.com, 박지훈
Dear all

3) I think that you couldn't do better than
modifying the /data/local.proc file to control log level of the application level.
if you add some properies in this file, you can control logs, i.e., Log.D(), Log.W(), etc.

Plz, check the sdk document on the below page.
http://developer.android.com/reference/android/util/Log.html#isLoggable%28java.lang.String,%20int%29

4) loglevel in the init.rc means that it controls a log level of the init process.
    Plz check the system/core/init/init.c source file.
    you can find NOTICE(), ERROR(), etc.

Thanks,
Edward

==================================
Android Framework Researcher
Edward Kim.
I look forward to hear from the publisher in USA
to publish my books about Android platform.

Isn't there anybody who has connections in the publisher?
Introduction to the book :
http://www.kapg.org/E_Inside_Android

2011/1/20 김우경 <car...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Tim Bird

unread,
Jan 20, 2011, 2:52:02 PM1/20/11
to android-...@googlegroups.com

I'm not sure I understand. Do you want to use the existing 'logcat'
program to save the logs, or do you want to write a new program
that saves logs, while preserving the ability of 'logcat' to also
show android logs from the command line?

The loglevel specified in init.rc only affects the logging emitted by
'init'. It doesn't affect the logging of any of the rest of the system.
That is, various parts of the init program issue log messages, with
log levels, when the program does certain actions. The init.rc loglevel
controls which of these will actually be written to the log by the
'init' program.

Does 3) mean you want to control what log messages are saved in your
persistent log file (in the file system)? Or are you trying to
control what messages are saved into the kernel log buffers to
begin with?

There's a writeup of the logging system, with a nice diagram, at:
http://elinux.org/Android_Logging_System

Note that the android logging system is completely separate from
the Linux kernel log system (which uses printk inside the kernel
to save messages and dmesg to extract them). You can write to
the kernel log from user space by writing to /dev/kmsg.

I've seen a reference to couple the two together, to redirect
android messages into the kernel log buffer, using the 'logcat'
program launched from init, like below:

service logcat /system/bin/logcat -f /dev/kmsg
oneshot

(See http://groups.google.com/group/android-kernel/browse_thread/thread/87d929863ce7c29e/f8b0da9ed6376b2f?pli=1)

However, this seems really wasteful of space (and time), since it
basically buffers each log message twice. Also, for your intended use
(saving messages to a file), this re-logging of messages into the kernel
log buffer seems orthogonal.

I hope this helps.
-- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Network Entertainment
=============================

김우경

unread,
Jan 21, 2011, 3:01:34 AM1/21/11
to android-...@googlegroups.com
hi~

i appreciate ur helpness

i want to save log whatever using a logcat or myapp.
importantant thing is save the log to file(location what i want).
and start time(save) is when device is booting..
this is way that understand my thinking.

if u started emulator.. eclipse DDMS(logcat) shows logsss from kernel is started.

and i want to save log that emulator shows continueosly

2011/1/21 Tim Bird <tim....@am.sony.com>

Dianne Hackborn

unread,
Jan 21, 2011, 12:31:56 PM1/21/11
to android-...@googlegroups.com
You could just run logcat >/some/file.txt at boot.

Please think carefully though about this -- the amount of logging is basically uncontrolled, and you will often find apps (and even some parts of the platform unfortunately) that can generate large amounts of logging data.  If you don't have limits on the amount you retain, you can easily chew up all of storage with your logs.

The current log buffers are intended to be able to keep a days with of logs...  there is still too much logging going on, though, so it can't reach that.  It would be really nice to reduce the amount of logging in places, and that is something you would want to consider before persisting all of that to disk.

And of course the main logs that apps use is just a big junk heap, you will find third party apps that spew a vast amount of stuff to it.  That is why we recently separated into two logs, so stuff written to the system log could have more assurance of staying around for a reasonable amount of time.
--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Reply all
Reply to author
Forward
0 new messages