您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在启动过程中更改默认控制台日志级别

在启动过程中更改默认控制台日志级别

我需要重新编译内核吗?

没有。

还是有一种方法可以使更改的值在重新引导后保持不变。

是。 使用内核命令行参数loglevel

loglevel=       All Kernel Messages with a loglevel smaller than the
                    console loglevel will be printed to the console. It can
                    also be changed with klogd or other programs. The
                    loglevels are defined as follows:

                    0 (KERN_EMERG)          system is unusable
                    1 (KERN_ALERT)          action must be taken immediately
                    2 (KERN_CRIT)           critical conditions
                    3 (KERN_ERR)            error conditions
                    4 (KERN_WARNING)        warning conditions
                    5 (KERN_NOTICE)         normal but significant condition
                    6 (KERN_INFO)           informational
                    7 (KERN_DEBUG)          debug-level messages

内核命令行上所有可能的参数列表都在Linux/Documentation/kernel- parameters.txt代码树的文件中。

根据您的引导程序(例如Grub或U-Boot),您将必须编辑文本以将此新参数添加到命令行。使用cat /proc/cmdline查看使用以前的引导内核的命令行。

为了显示所有内容,为loglevel参数提供的数字应大于KERN_DEBUG。 也就是说,您必须指定loglevel=8。 或者直接使用该ignore_loglevel参数显示所有内核消息。

其他 2022/1/1 18:19:35 有542人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶