Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| console_loglevel [2018/08/21 12:34] – [Overview] rpjday | console_loglevel [2018/11/23 15:33] (current) – [Overview] rpjday | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | How to mess with '' | + | Properties of console |
| ===== Files ===== | ===== Files ===== | ||
| + | |||
| + | ==== Kernel source files ==== | ||
| + | |||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ==== Running system files ==== | ||
| + | |||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | ===== Kernel parameters ===== | ||
| + | |||
| + | < | ||
| + | loglevel= | ||
| + | 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) | ||
| + | 1 (KERN_ALERT) | ||
| + | 2 (KERN_CRIT) | ||
| + | 3 (KERN_ERR) | ||
| + | 4 (KERN_WARNING) | ||
| + | 5 (KERN_NOTICE) | ||
| + | 6 (KERN_INFO) | ||
| + | 7 (KERN_DEBUG) | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | ignore_loglevel [KNL] | ||
| + | Ignore loglevel setting - this will print /all/ | ||
| + | kernel messages to the console. Useful for debugging. | ||
| + | We also add it as printk module parameter, so users | ||
| + | could change it dynamically, | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ===== Kernel source files ===== | ||
| + | |||
| + | ==== kernel/ | ||
| + | |||
| + | < | ||
| + | int console_printk[4] = { | ||
| + | CONSOLE_LOGLEVEL_DEFAULT, | ||
| + | MESSAGE_LOGLEVEL_DEFAULT, | ||
| + | CONSOLE_LOGLEVEL_MIN, | ||
| + | CONSOLE_LOGLEVEL_DEFAULT, | ||
| + | }; | ||
| + | </ | ||
| ==== include/ | ==== include/ | ||
| Line 14: | Line 77: | ||
| #define CONSOLE_LOGLEVEL_SILENT | #define CONSOLE_LOGLEVEL_SILENT | ||
| #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ | #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ | ||
| - | #define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with " | ||
| #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ | #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ | ||
| #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ | #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ | ||
| /* | /* | ||
| - | * Default used to be hard-coded at 7, we're now allowing | + | * Default used to be hard-coded at 7, quiet used to be hardcoded at 4, |
| - | | + | |
| */ | */ | ||
| #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT | #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT | ||
| + | #define CONSOLE_LOGLEVEL_QUIET CONFIG_CONSOLE_LOGLEVEL_QUIET | ||
| extern int console_printk[]; | extern int console_printk[]; | ||
| Line 41: | Line 104: | ||
| console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; | console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; | ||
| } | } | ||
| + | </ | ||
| + | ==== lib/ | ||
| + | |||
| + | < | ||
| + | config CONSOLE_LOGLEVEL_DEFAULT | ||
| + | int " | ||
| + | range 1 15 | ||
| + | default " | ||
| + | help | ||
| + | Default loglevel to determine what will be printed on the console. | ||
| + | |||
| + | Setting a default here is equivalent to passing in loglevel=< | ||
| + | the kernel bootargs. loglevel=< | ||
| + | value is specified here as well. | ||
| + | |||
| + | Note: This does not affect the log level of un-prefixed printk() | ||
| + | usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT | ||
| + | option. | ||
| + | |||
| + | config CONSOLE_LOGLEVEL_QUIET | ||
| + | int "quiet console loglevel (1-15)" | ||
| + | range 1 15 | ||
| + | default " | ||
| + | help | ||
| + | loglevel to use when " | ||
| + | |||
| + | When " | ||
| + | will be used as the loglevel. IOW passing " | ||
| + | equivalent of passing " | ||
| + | |||
| + | config MESSAGE_LOGLEVEL_DEFAULT | ||
| + | int " | ||
| + | range 1 7 | ||
| + | default " | ||
| + | help | ||
| + | Default log level for printk statements with no specified priority. | ||
| + | |||
| + | This was hard-coded to KERN_WARNING since at least 2.6.10 but folks | ||
| + | that are auditing their logs closely may want to set it to a lower | ||
| + | priority. | ||
| + | |||
| + | Note: This does not affect what message level gets printed on the console | ||
| + | by default. To change that, use loglevel=< | ||
| + | or pick a different CONSOLE_LOGLEVEL_DEFAULT configuration value. | ||
| </ | </ | ||
| - | ===== init/ | + | ==== init/main.c ==== |
| < | < | ||