android log.
来源:互联网 发布:匡恩网络 发工资 编辑:程序博客网 时间:2024/05/17 23:45
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/87...)
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.
adb dmesg
cat /proc/kmsg
$adb shell dmesg
echo 7 > /proc/sys/kernel/printk
Well, it isn't very hard to debug the kernel in the emulator.
Configure the kernel by hand to include debugging symbols:
cd kernel
make menuconfig
Select Kernel hacking or whatever it is called and select the item
which says to compile the kernel with debugging info.
make
cd ..
When starting the emulator use sth like: (but change the openbsd refs
to linux)
out/host/openbsd-x86_64/bin/emulator -show-kernel -system out/target/
product/generic -kernel kernel/arch/arm/boot/zImage -logcat *:v -qemu
-monitor telnet::4444,server -s
then it will sit waiting for you to prepare your gdb session:
prebuilt/openbsd-x86_64/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gdb
kernel/vmlinux
(gdb) br sys_execve (or some other place you want to gain control)
(gdb) target remote localhost:1234
and then, in another window, release qemu by attaching to its monitor:
telnet localhost 4444
(qemu) cont
well it's somewhat from memory, but I suspect, the info given will
work with perhaps a few modifications...
I just hope that you are hunting for easier bugs than I am... :-)
Good luck
On Nov 29, 5:47 am, allstars <allstars....@gmail.com> wrote:
I do it all the time.
Here's a paste of how I start the emulator. If this does no work you
are basing it of a different tree than I (do you use cupcake? maybe it's
changed there?)
/home/projects/android/mydroid/out/host/openbsd-x86_64/bin/emulator
-system out/target/product/generic -kernel kernel/arch/arm/boot/zImage
-show-kernel -logcat *:v -qemu -monitor telnet::4444,server -s
After this the emulator should start waiting for a telnet connection to
port 4444. Then I do:
telnet localhost 4444
and issue the "stop" command immediately. Right after the connect to
4444, the kernel should start listening on port 1234 for an ARM gdb to
attach to.
Niklas
printk's output goes to several places:
1. The system console (default is the currently active text mode VT).
2. It gets sent to /proc/kmsg.
/proc/kmsg is a binary interface for retrieving kernel messages and setting kernel logging settings. Normally, the only process using it is klogd, which captures all kernel log messages and passes them on to syslogd. syslogd then multiplexes them to a couple of files, depending on what is configured in /etc/syslog.conf. Normally, messages of the DEBUG priority are discarded, so if you're logging with printk(KERN_DEBUG "..."), syslogd will discard them.
See the syslog(3) and syslogd(8) and syslog.conf(5) manpages for more info on syslogging. I normally add these lines to my /etc/syslog.conf on a new system, in order to be able to see all log messages easily:
*.* /dev/tty12*.* /var/log/all
Also, there's an ioctl that you can use to redirect the system console output to another terminal -- you open a terminal and run this ioctl with no parameters on it, and the console output will get there. See tty_ioctl(4) for more info. The only program I know of right now that can do this is screen. Run the command C-a : console RET in screen to make it display the console output. I believe, although I'm not sure, that it will not show debug message, however. The best option may be to make syslogd redirect the output where you want it. Remember "tail -f".
hi guys,
I am creating a driver under MontaVista Linux. I want the module
to log its messages to a specific file. I tried editting the
/etc/syslog.conf file. I was able to redirect all the KERN_ERR kernel
messages (including other error messages) to a specific file instead
of logging them to /var/log/messages. However, I have no idea how to
edit the syslog.conf file to log only the messages generated by my
driver to a specific file. I want to create my own directory in the
/var/log directory where I can store the different message levels of
my driver. Is this possible? Can somebody teach me how? Thank you
so much!
http://www.ibm.com/developerworks/linux/library/l-kernel-logging-apis/?ca=drs-
http://www.onlinehowto.net/Tutorials/System/Enable-kernel-logging/1480
告诉你两种方法吧,其实本质是一样的。 直接运行dmesg
前提是adb shell能成功。
1.
./adb shell
#cd /data/anr
#cat /proc/kmsg kernel.txt
这时kernel.txt放在emulator中的/data/anr下。
2.
./adb shell cat /proc/kmsg > kernel.txt
这时kernel.txt放在adb所在的目录下。
- Android log
- android log
- android : log
- android log.
- android log
- android log
- Android LOG
- android log
- android log
- Android-log
- android log
- Android Log
- Android Log
- Android Log
- android log
- android-log
- android log
- android log
- epoll使用详解
- GetLastError
- 解决WIN2008 R2 x64未注册Microsoft.Jet.OLEDB.4.0程序错误
- ubuntu 64bit arm-linux-gcc: No such file or directory 问题
- shell程序获取互联网公司web server 信息(伪多线程shell程序)
- android log.
- 控件的调用和设置
- 关于FF和IE在Javascript和CSS的区别的收集
- php几个缓存相关的系统函数
- Groovy 1.8 新特性: 原生 JSON 支持
- 【zz】C++开发者快速学习Objective-C语言核心语法
- [转]海量数据面试题整理
- Swing 小记
- weblogic9 与 birt 的冲突问题