diff options
Diffstat (limited to 'md/writeup/kernel_debug_messages.md')
-rw-r--r-- | md/writeup/kernel_debug_messages.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/md/writeup/kernel_debug_messages.md b/md/writeup/kernel_debug_messages.md index 02b6fe8..1ff8854 100644 --- a/md/writeup/kernel_debug_messages.md +++ b/md/writeup/kernel_debug_messages.md @@ -30,7 +30,7 @@ Here is defintions of log levels from __include/linux/kern_levels.h__ As we can see kernel printk level is detemined from first bytes from begining of printed string. Basic usage of log level -``` +```c printk(KERN_ERR"Error division by 0\n"); ``` @@ -40,11 +40,11 @@ No need to write comma after log level as it will just concatenated with string. ## Set loging level To see messages in userspace you can use -``` +```sh dmesg ``` Loged messages you can see in __/proc/sys/kernel/printk__ -``` +```sh $ cat /proc/sys/kernel/printk 7 4 1 7 ``` @@ -56,7 +56,7 @@ Column values are If one does not specify the log level then the default log level of KERN_WARNING is used. For example, enable all levels of console message: -``` +```sh echo 7 > /proc/sys/kernel/printk ``` @@ -70,13 +70,13 @@ Timing information could be added to printk messages you need to enable in menuconfig __Kernel Hacking > printk and dmesg options >__ -``` +```sh CONFIG_PRINTK_TIME=y ``` ### Loglevel at kernel boot There is possible to set loglevel at bootup as kernel parametr -``` +```sh loglevel= ``` | Value | Name | Desc | |