内核中的打印输出去哪里了? [英] Where does output of print in kernel go?
问题描述
我正在调试一个linux驱动(特别是ubuntu server 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
");
...
在 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屋!