OVH Cloud OVH Cloud

writing to syslog file

1 réponse
Avatar
Alaa
Hi all,

I'm using Linux Kernel 2.6.17.6 and I need to write some specific
messages into syslog file. I'm using the syslog command:
syslog(LOG_INFO, "message");

After recompiling the kernel, I can not get any message in the syslog
file. Am I missing anything ? also, do I need to define the LOG_INFO
within the code and how?

Actually, I need to repeat this message several times within the same
kernel file (tcp_input.c).
Please advice, I really need help as soon as possible.

Thanks for your help,
Alaa

1 réponse

Avatar
JustMe
Alaa a écrit
Hi all,

I'm using Linux Kernel 2.6.17.6 and I need to write some specific
messages into syslog file. I'm using the syslog command:
syslog(LOG_INFO, "message");

After recompiling the kernel, I can not get any message in the syslog
file. Am I missing anything ? also, do I need to define the LOG_INFO
within the code and how?

Actually, I need to repeat this message several times within the same
kernel file (tcp_input.c).
Please advice, I really need help as soon as possible.

Thanks for your help,
Alaa


Following the FM (RTFM :-)), correct syntax is :

int syslog(int type, char *bufp, int len);

But I'm not sure if syslog is designed to be called withing the kernel
itself. Take a look to how kernel programs do log info...

If I remember correctly, printk is to be used in this case...