printk-在任何内核日志级别的消息日志中显示,但不在终端中显示 [英] printk - showing in message log but not in terminal for any kernel log level

查看:401
本文介绍了printk-在任何内核日志级别的消息日志中显示,但不在终端中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些内核修改,并试图让printk将信息输出回控制台.我将任何内核日志级别传递给它,即使对于最高日志级别,也无法在控制台上正确获得任何响应.

I'm doing some kernel modification and am trying to get printk to output information back to the console. I pass any kernel log level with it and do not properly get any response back on the console for even the highest log levels.

我检查了一下,printk的当前日志配置为4 4 1 7.

I checked and the current log configuration for printk is 4 4 1 7.

每次都可以正确打印到日志.我可以使用dmesg |更少,然后将其附加到日志中.但是我无法使用printk将其正确返回控制台.

It prints properly each time to logs. I can use dmesg | less and see it appended to the log. But I can't return it to console properly using printk.

我不确定是否很重要,但是我使用SSH连接到存在已修改内核的远程计算机.

I'm not sure that it matters but I use SSH to connect to a remote machine where the modified kernel exists.

我已经从gnome-terminal和Windows的腻子中尝试了SSH.两者都没有改变.在服务器的日志中仍然显示printk,但在我的控制台上却没有.

I've tried SSH from gnome-terminal and from putty in Windows. Neither change a thing. Still shows printk in the server's logs, but not on my console.

有什么办法可以将它带到控制台吗?考虑到我已经尝试了每个日志级别并且没有任何效果,可能会出什么问题?谢谢!

Any way to get it to the console? What could be going wrong given that I've tried every log level and none work? THANKS!

推荐答案

我相信prink仅记录到物理控制台,如果要通过任意tty监视内核输出,则需要使用tail来监视syslog或专门监视/dev/console消息的应用程序(例如xconsole)写入的文件.

I believe that prink only logs to the physical consoles, if you want to monitor the kernel output via arbitrary ttys, then you will need to use tail to monitor a file being written to by syslog, or an application such as xconsole which specifically monitors /dev/console for messages.

这篇关于printk-在任何内核日志级别的消息日志中显示,但不在终端中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆