(OK) How can I show printk() message in konsole?
来源:互联网 发布:python 转换成数字 编辑:程序博客网 时间:2024/04/28 18:47
http://stackoverflow.com/questions/27903915/how-can-i-show-printk-message-in-konsole
The syntax of printk is
printk ("log level" "message", <arguments>);
kernel defines 8 log levels in the file printk.h
#define KERN_EMERG "<0>" /* system is unusable*/#define KERN_ALERT "<1>" /* action must be taken immediately*/#define KERN_CRIT "<2>" /* critical conditions*/#define KERN_ERR "<3>" /* error conditions*/#define KERN_WARNING "<4>" /* warning conditions*/#define KERN_NOTICE "<5>" /* normal but significant condition*/#define KERN_INFO "<6>" /* informational*/#define KERN_DEBUG "<7>" /* debug-level messages*/
Each log level corresponds to a number and the lower the number higher the importance of the message.
The levels are useful in deciding what should be displayed to the user on the console and what should not be.
Every console has log level called as the the console log level and any message with a log level number lesser than the console log level gets displayed on the console, and other messages which have a log level number higher or equal to the console log level are logged in the kernel log(kernel buffer) which can be looked into using the command "dmesg".
The console loglevel can be found by looking into the file /proc/sys/kernel/printk
$ cat /proc/sys/kernel/printk4 4 1 7
The first number in the output is the console log level, the second is the default log level, third is the minimum log level and fourth is the maximum log level.
Log level 4 corresponds to KERN_WARNING. Thus all the messages with log levels 3,2,1 and 0 will get displayed on the screen as well as logged and the messages with log level 4,5,6,7 only get logged and can be viewed using "dmesg".
The console log level can be changed by writing into the proc entry
$ echo "6" > /proc/sys/kernel/printk$ cat /proc/sys/kernel/printk6 4 1 7
Now the console log level is set to 6, which is KERN_INFO.
Here you want to print out every message so you should set your console level at highest number "8"
echo "8" > /proc/sys/kernel/printk tail -f /var/log/kern.log &
or
cat /proc/kmsg & (Android Environment)
- (OK) How can I show printk() message in konsole?
- How can I edit the welcome message when ssh start?
- How can I convert printStackTrace message to a string?
- How can I handle hardware keys in my application?
- How Can i Store photo (image) in column of table
- How can I run Perl system commands in the background
- How can i check if an app running in Android?
- How can I renew or release an IP in Linux?
- How can I convert String to Int in C#?
- How can I set default terminal used in Unity?
- How Can I Create Histogram Projection In Opencv ?
- How can I prevent SQL-injection in PHP?
- How can I patch the kernel in Yocto Project
- IDE - How can I permanently have line numbers in IntelliJ?
- How Can I Stop
- How can I plot an image (.jpg) in MATLAB in both 2-D and 3-D?
- How can i get FWHM?
- How can I recover a file that I deleted in my local repo from the remote repo in Git?
- c++类的构造函数详解
- php----头像上的马赛克
- 使用Spring Security实现权限管理
- windows 下codeblocks c++环境配置
- leetcode 300. Longest Increasing
- (OK) How can I show printk() message in konsole?
- HTML + js 实现简单的钟表
- leetcode 28. Implement strStr()
- java Map及Map.Entry详解
- 前端Javascript与Nodejs的异同
- leetcode 198. House Robber
- android中倒计时功能
- Hibernate一对一关系映射
- leetcode 151. Reverse Words in a String