在启动过程中更改默认控制台日志级别 [英] Change default console loglevel during boot up

查看:166
本文介绍了在启动过程中更改默认控制台日志级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个CentOS 6.3安装程序,在该程序上,控制台日志级别设置为4,默认日志级别设置为4.我知道我可以使用以下步骤来更改默认控制台日志级别:

I setup a CentOS 6.3 setup, on which the console loglevel is set to 4, and default log level is set to 4. I know I can change the default console log level using the following steps:

cat /proc/sys/kernel/printk

4   4   1   7

echo 5 > /proc/sys/kernel/printk
cat /proc/sys/kernel/printk

5   4   1   7

但是,重新启动后,控制台日志级别将恢复为原始值.我是否需要重新编译内核,或者有什么方法可以使更改后的值在重新启动后保持不变.

However, upon reboot, the console log level reverts back to the original value. Do I need to recompile the kernel, or is there a way I can get the changed value to be persistent across reboot.

推荐答案

我是否需要重新编译内核,

Do I need to recompile the kernel,

否.

还是有一种方法可以使更改后的值在重新启动后保持不变.

or is there a way I can get the changed value to be persistent across reboot.

是的
使用内核命令行参数loglevel:

Yes.
Use the kernel command line parameter 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

内核命令行上所有可能的参数列表位于

The entire list of parameters possible on the kernel command line are in the Linux/Documentation/kernel-parameters.txt file in the source tree.

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

Depending on your bootloader (e.g. Grub or U-Boot), you will have to edit text to add this new parameter to the command line. Use cat /proc/cmdline to view the kernel command line used for the previous boot.

附录

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

To display everything, the number supplied for the loglevel parameter would have be be greater than KERN_DEBUG.
That is, you would have to specify loglevel=8.
Or simply use the ignore_loglevel parameter to display all kernel messages.

这篇关于在启动过程中更改默认控制台日志级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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