Alter the dmesg Log Level

Where i is 1 to 8 inclusive:

dmesg -n${i}

Only messages with a lower value will be reported on the console. - 1 - print only emergency messages - 8 - print all messages

All messages will still be added to the buffer, and are accessible via dmesg.

Reducing the log level can help with maintaining performance while writing a lot of debug information.

Levels

See include/linux/kern_levels.h:

  • 0 - KERN_EMERG - system is unusable, cannot be masked
  • 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

Default

If you don't specify a log level in your message it defaults to KERN_DEFAULT.

KERN_DEFAULT (d) can be configured via CONFIG_DEFAULT_MESSAGE_LOGLEVEL, as defined in lib/Kconfig.debug.