kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Displaying debug level printk messages in systemd
@ 2015-07-11 13:06 Orion Agali
  2015-07-11 14:36 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Orion Agali @ 2015-07-11 13:06 UTC (permalink / raw)
  To: kernelnewbies

I'm using Arch and I cannot figure out how to get printk debug messages to display in journalctl.

I tried the following:
  * Set LogLevel=debug in /etc/systemd/systemd.conf
  * Add kernel parameter 'debug' on boot
  * Setting loglevel=8 in /proc/sys/kernel/printk
  * dmsg -n 8

Consider the following module:
Konsole output

----------
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
static int __init task1_init(void)
{
    pr_notice("I am at level notice");
    pr_debug("I am at level debug.");
    return 0;
}
static void __exit task1_exit(void){}
module_init(task1_init);
module_exit(task1_exit);
------------

The notice level is printed but the debug level is not.
The debug message is not in dmesg or /dev/kmsg either

The answer is probably straight forward, but I've hit a wall so I'm hoping
somebody here will be able to point me in the right direction
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150711/c34b4ecd/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Displaying debug level printk messages in systemd
  2015-07-11 13:06 Displaying debug level printk messages in systemd Orion Agali
@ 2015-07-11 14:36 ` Greg KH
  2015-07-11 15:42   ` Orion Agali
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2015-07-11 14:36 UTC (permalink / raw)
  To: kernelnewbies

On Sat, Jul 11, 2015 at 11:06:30PM +1000, Orion Agali wrote:
> I'm using Arch and I cannot figure out how to get printk debug messages to
> display in journalctl.
> 
> I tried the following:
> ? * Set LogLevel=debug in /etc/systemd/systemd.conf
> ? * Add kernel parameter 'debug' on boot
> ? * Setting loglevel=8 in /proc/sys/kernel/printk
> ? * dmsg -n 8
> 
> Consider the following module:
> 
> ----------
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/init.h>
> static int __init task1_init(void)
> {
> ??? pr_notice("I am at level notice");
> ??? pr_debug("I am at level debug.");
> ??? return 0;
> }
> static void __exit task1_exit(void){}
> module_init(task1_init);
> module_exit(task1_exit);
> ------------
> 
> The notice level is printed but the debug level is not.
> The debug message is not in dmesg or /dev/kmsg either
> 
> The answer is probably straight forward, but I've hit a wall so I'm hoping
> somebody here will be able to point me in the right direction

Take a look at Documentation/dynamic-debug-howto.txt for how to get
pr_debug() working properly for your module.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Displaying debug level printk messages in systemd
  2015-07-11 14:36 ` Greg KH
@ 2015-07-11 15:42   ` Orion Agali
  0 siblings, 0 replies; 3+ messages in thread
From: Orion Agali @ 2015-07-11 15:42 UTC (permalink / raw)
  To: kernelnewbies

On 07/12/2015 12:36 AM, Greg KH wrote:
> On Sat, Jul 11, 2015 at 11:06:30PM +1000, Orion Agali wrote:
>> I'm using Arch and I cannot figure out how to get printk debug messages to
>> display in journalctl.
>>
>> I tried the following:
>>   * Set LogLevel=debug in /etc/systemd/systemd.conf
>>   * Add kernel parameter 'debug' on boot
>>   * Setting loglevel=8 in /proc/sys/kernel/printk
>>   * dmsg -n 8
>>
>> Consider the following module:
>>
>> ----------
>> #include <linux/module.h>
>> #include <linux/kernel.h>
>> #include <linux/init.h>
>> static int __init task1_init(void)
>> {
>>     pr_notice("I am at level notice");
>>     pr_debug("I am at level debug.");
>>     return 0;
>> }
>> static void __exit task1_exit(void){}
>> module_init(task1_init);
>> module_exit(task1_exit);
>> ------------
>>
>> The notice level is printed but the debug level is not.
>> The debug message is not in dmesg or /dev/kmsg either
>>
>> The answer is probably straight forward, but I've hit a wall so I'm hoping
>> somebody here will be able to point me in the right direction
> Take a look at Documentation/dynamic-debug-howto.txt for how to get
> pr_debug() working properly for your module.
>
Great reference!

After reading and testing I realize I can
  * activate at compile time using -DDEBUG
  * use dyndbg in the module paramaters
  * add queries to <debugfs>/dynamic_debug/control
  * use dyndbg in the boot string

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-11 15:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-11 13:06 Displaying debug level printk messages in systemd Orion Agali
2015-07-11 14:36 ` Greg KH
2015-07-11 15:42   ` Orion Agali

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).