Question : How to use klogd properly?

I am new to Linux and I have a hard time making klogd work properly to display debug messages.
I'm writing Linux driver modules using insmod and rmmod. I have kprint output debug messages but I need to figure out how to have klogd display the debug messages.

It looks like klogd was already initialized during the boot up process (I'm using Ubuntu). So when I entered:
$ klogd -c 8
It says klogd is already running. The question is what do I need to do to prevent klogd from being initialized. And if there is any way to reintialize klogd to a higher level (8) so I can see the debug messages.

Answer : How to use klogd properly?

Your simplest method is to dispense with klogd altogether. In the attached example
- make sure /proc/kmsg exists (it's possible though unlikely that it doesn't)
- find out the pid of klogd
- kill klogd
- make sure it's gone
- cat /proc/kmsg directly in your window of choice - you'll see everything

I plugged in a USB stick to generate some messages. You don't get timestamps like you would with klogd / syslogd but I imagine that doesn't worry you
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
07:51:03# ls -l /proc/kmsg 
-r--------  1 root root 0 2008-02-04 07:51 /proc/kmsg
07:54:46# ps ax|grep klogd
 2208 ?        Ss     0:00 /usr/sbin/klogd -c 3 -x
 2214 pts/9    S+     0:00 grep klogd
07:55:00# kill 2208
07:55:45# ps ax|grep klogd
 2216 pts/9    S+     0:00 grep klogd
07:59:17# cat /proc/kmsg
<7>hub 1-0:1.0: state 7 ports 4 chg 0000 evt 0004
<7>ehci_hcd 0000:00:05.2: GetStatus port 2 status 001803 POWER sig=j CSC CONNECT
<7>hub 1-0:1.0: port 2, status 0501, change 0001, 480 Mb/s
<7>hub 1-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x501
Open in New Window Select All
Random Solutions  
 
programming4us programming4us