Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.sys.hp.hpux FAQ
Section - 6.1.5 Why is syslog() call not doing what i want it to?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Business Photos and Profiles ]


Top Document: comp.sys.hp.hpux FAQ
Previous Document: 6.1.4 How can I tell if something was built debuggable?
Next Document: 6.1.6 How can I get C programs to automatically generate stack dumps?
See reader questions & answers on this topic! - Help others by sharing your knowledge
My program looks like:

#include <syslog.h>
void main(int argc,char *argv[])
{
 syslog(LOG_EMERG,"This is an emergency message\n"));
 syslog(LOG_ALERT,"This is an alert message\n");
 syslog(LOG_CRIT,"This is a critical message\n");
 syslog(LOG_ERR,"This is an error message\n");
 syslog(LOG_WARNING,"This is a warning\n");
 syslog(LOG_NOTICE,"This is a notice\n");
 syslog(LOG_INFO,"This is an informal message\n");
 syslog(LOG_DEBUG,"This is a debug message\n");
}

It doesn't log all the messages to /var/adm/syslog - why not?

First of all, the LOG_EMERG can not be used with user processes and should
return -1 (if you check the return status).  This is not documented in the
man page! All the other messages should appear, but your /etc/syslog.conf
file might not be configured correctly. To test it, replace the
/etc/syslog.conf with the following line:

   *.debug                 /var/adm/syslog

Then do: kill -HUP `cat /etc/syslog.pid`
Then run the test program and then tail the /var/adm/syslog file
and you should see all the messages, ie:

   Nov 23 09:02:54 orca syslogd: restart
   Nov 23 09:02:58 orca syslog: This is an alert message
   Nov 23 09:02:58 orca syslog: This is a critical message
   Nov 23 09:02:58 orca syslog: This is an error message
   Nov 23 09:02:58 orca syslog: This is a warning
   Nov 23 09:02:58 orca syslog: This is a notice
   Nov 23 09:02:58 orca syslog: This is an informal message
   Nov 23 09:02:58 orca syslog: This is a debug message

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: comp.sys.hp.hpux FAQ
Previous Document: 6.1.4 How can I tell if something was built debuggable?
Next Document: 6.1.6 How can I get C programs to automatically generate stack dumps?

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
hpux.faq@gmail.com





Last Update March 27 2014 @ 02:11 PM