一:printk日志级别

数字越小级别越高
linux log-LMLPHP

二:printk打印消息控制

linux log-LMLPHP
console_loglevel:只有当printk打印消息的log优先级高于console_loglevel时,才能输出到终端上
default_message_loglevel:printk打印消息时默认的log等级
minimum_console_loglevel:console_loglevel可以被设置的最小值
default_console_loglevel:console_loglevel的缺省值

printk

printk(KERN_EMERG " KERN_EMERG\n");
printk(KERN_ALERT " KERN_ALERT\n");
printk(KERN_CRIT " KERN_CRIT\n");
printk(KERN_ERR " KERN_ERR\n");
printk(KERN_WARNING " KERN_WARNING\n");
printk(KERN_NOTICE " KERN_NOTICE\n");
printk(KERN_INFO " KERN_INFO\n");
printk(KERN_DEBUG " KERN_DEBUG\n");
printk(" no_fix\n");

printk消息等级查看与修改

  1. 查看
    cat /proc/sys/kernel/printk
    # 7 4 1 7
    
  2. 修改
    echo 8 4 1 7 > /proc/sys/kernel/printk
    

/etc/rsyslog.conf

linux log-LMLPHP
配置dmesg信息保存路径

06-08 17:23