Parent document is top of "comp.sys.hp.hpux FAQ"
Previous document is "8.10 Is there an equivalent for getrusage()?"
Next document is "8.12 Is trace on HP-UX?"
8.11 Why is syslog() call not doing what i want it to?
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 does log all the messages to /usr/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 message should appear, but you're /etc/syslog.conf
file might not be configured correctly. To test it replace the
/etc/syslog.conf with the following line:
*.debug /usr/adm/syslog
Then do: kill -HUP `cat /etc/syslog.pid`
Then run the test program and then tail the /usr/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
(Thanks to Colin Wynd)
Parent document is top of "comp.sys.hp.hpux FAQ"
Previous document is "8.10 Is there an equivalent for getrusage()?"
Next document is "8.12 Is trace on HP-UX?"