Date: Sun, 7 Sep 1997 09:48:55 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: freebsd-hackers@FreeBSD.ORG Cc: jamil@counterintelligence.ml.org (Jamil J. Weatherbee) Subject: Re: Syslog Facility Message-ID: <19970907094855.FR18909@uriah.heep.sax.de> In-Reply-To: <Pine.BSF.3.96.970901143100.1779A-100000@counterintelligence.ml.org>; from Jamil J. Weatherbee on Sep 1, 1997 14:38:58 -0700 References: <Pine.BSF.3.96.970901135441.1473A-100000@counterintelligence.ml.org> <Pine.BSF.3.96.970901143100.1779A-100000@counterintelligence.ml.org>
next in thread | previous in thread | raw e-mail | index | archive | help
As Jamil J. Weatherbee wrote: > I have looked at the code to lpd and pppd and I can't figure what I am > doing wrong here. I am doing an: > > openlog (argv[0], LOG_PID|LOG_NDELAY, LOG_DAEMON); > > in main an later in another function > > syslog (LOG_ERR, "some message"); > > but the syslog facillity is refusing to log the process id number eg: > > date machine programname[pid]: message j@uriah 973% cat > foo.c #include <sys/types.h> #include <sys/syslog.h> int main(void) { openlog("junk", LOG_PID | LOG_NDELAY, LOG_USER); syslog(LOG_ERR, "some junk"); return 0; } ^D j@uriah 974% make foo cc -O2 -m486 -pipe foo.c -o foo j@uriah 975% ./foo j@uriah 976% Sep 7 09:47:21 uriah junk[5692]: some junk It works for me. Btw., using argv[0] directly is not a good idea. Strip off the leading pathname components. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970907094855.FR18909>