[wplug] using printk
Henry Umansky
hmust2+ at pitt.edu
Wed Nov 13 10:53:25 EST 2002
This is what I am trying to do:
#define MODULE
#include <linux/module.h>
int init_module(void)
{
printk("Hello kernel n");
return 0;
}
and my syslog.conf file is:
*.info /var/log/messages
so everything above info should be logged, but I'm guessing that I need
everything above debug.
-Henry
--On Wednesday, November 13, 2002 10:34 AM -0500 "Ingimarson, Darin"
<dingimarson at Quantapoint.com> wrote:r
> Henry,
>
> I am assuming you are hacking kernel code...
>
> printk() will print to /var/log/messages or the console depending
> upon what the settings are in your syslog config file. If you want
> to force it to print out, you can specify the loglevel as critical
> in your printk call as folows:
>
> printk(KERN_CRIT, "Something important happened here...\n");
>
> This should make the message appear both on the console and in the
> /var/log/messages file.
>
> There are eight possible loglevels as follows:
> KERN_EMERG
> KERN_ALERT
> KERN_CRIT
> KERN_ERR
> KERN_WARNING
> KERN_NOTICE
> KERN_INFO
> KERN_DEBUG
>
> A printk() with no specified priority defaults to DEFAULT_MESSAGE_LOGLEVEL
>
> You can modify the console loglevel using the proc filesystem as follows:
>
># echo 8 > /proc/sys/kernel/printk
>
> This will cause ALL kernel messages to appear at the console (note that
> you will need an actual CONSOLE to print this out on, not some xterm
> window).
>
> Check your system to see if both klogd and syslogd are running; the
> kernel messages from the modules should be logged to /var/log/messages
> based upon the configuration of these. If klogd is not running, the
> messages will NOT reach user space unless /proc/kmsg is being read by
> soemthing.
>
>
>> -----Original Message-----
>> From: Henry Umansky [mailto:hmust2+ at pitt.edu]
>> Sent: Wednesday, November 13, 2002 10:21 AM
>> To: wplug at wplug.org
>> Subject: [wplug] using printk
>>
>>
>> When using printk("string") in a kernel module, where does it
>> print to?? I
>> thought it would print to /var/log/messages but it is not there.
>>
>> -Henry
>> _______________________________________________
>> wplug mailing list
>> wplug at wplug.org
>> http://www.wplug.org/mailman/listinfo/wplug
>>
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
Henry Umansky
University of Pittsburgh
Systems/Programmer III
www.pitt.edu/~hmust2
hmust2 at pitt.edu
(412)624-4357
More information about the wplug
mailing list