内核中的打印输出到哪里去了? [英] Where does output of print in kernel go?
问题描述
我正在调试Linux(特别是ubuntu服务器9.04)的驱动程序,并且代码中有几个printf语句.
I am debugging a driver for linux (specifically ubuntu server 9.04), and there are several printf statements in the code.
在哪里可以查看这些语句的输出?
Where can I view the output of these statements?
我要执行的操作是使用proc文件系统写入内核. 打印代码是
What i'm trying to do is write to kernel using the proc file-system. The print code is
static int proc_fractel_config_write(struct file *file, const char *argbuf, unsigned long count, void *data)
{
printk(KERN_DEBUG "writing fractel config\n");
...
在kern.log中,当我尝试覆盖文件/proc/net/madwifi/ath1/fractel_config(当然会随着时间变化)时,会看到以下消息.
In kern.log, I see the following message when i try to overwrite the file /proc/net/madwifi/ath1/fractel_config (with varying time of course).
[ 8671.924873] proc write
[ 8671.924919]
有什么解释吗?
推荐答案
这取决于分发,但是许多人使用klogd(8)
从内核获取消息,并将消息记录到文件中(有时/var/log/dmesg
或/var/log/kernel
)或通过syslog(3)
到系统日志.在后一种情况下,日志条目的结束位置将取决于syslogd(8)
的配置.
It depends on the distribution, but many use klogd(8)
to get the messages from the kernel and will either log them to a file (sometimes /var/log/dmesg
or /var/log/kernel
) or to the system log via syslog(3)
. In the latter case, where the log entries end up will depend on the configuration of syslogd(8)
.
关于dmesg
命令的注意事项:内核消息存储在循环缓冲区中,因此大量输出将被覆盖.
One note about the dmesg
command: Kernel messages are stored in a circular buffer, so large amounts of output will be overwritten.
这篇关于内核中的打印输出到哪里去了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!