David
David

Reputation: 4818

printk not working for kernel debgugging

I put some debugging messages in the kernel code. have checked /var/log/messages, dmesg and there is no such dump there. syslogd is running on the machine

i also changed /proc/sys/kernel/printk to 8 4 1 7

any idea what can be the problem?

Upvotes: 4

Views: 10644

Answers (2)

Monkey_play
Monkey_play

Reputation: 73

I faced the same problem until yesterday, when i found something interesting. Lately linux kernel has been adopting pr_** instead of printk (3.5 version and later).

I have tried running a basic module program with printk on 3.3 version of the kernel & the same on 3.7 and above.

Former works fine. Later just doesn't show up the printk's on dmesg or /var/log/messages. However replacing the printk with pr_info macro,did the job. (other variants are also there pr_err, pr_notice etc found in include/linux/kernel.h earlier now moved to include/linux/printk.h)

Although, pr_** macro's are quite old, thanks to campaign by Joe Perches, who has initiated the above mentioned change, we better learn the kernel ways ! (Reference: pr_info())

Upvotes: 3

sarnold
sarnold

Reputation: 104110

The easiest explanation is your printk() is not being called.

Keep it simple and stick to checking dmesg(1) output while you're debugging this problem -- all the syslog(3) /var/log/messages and the console based output are separate from the issue of the messages not even showing up in the kernel's message buffer.

Upvotes: 0

Related Questions