[496] in Pthreads mailing list archive
Re: syslog with pthreads
daemon@ATHENA.MIT.EDU (Larry V. Streepy, Jr.)
Tue Nov 12 15:21:12 1996
Date: Tue, 12 Nov 1996 12:54:47 -0700
From: "Larry V. Streepy, Jr." <streepy@healthcare.com>
To: Stewart Gebbie <stewart@lin01.global.co.za>
Cc: pthreads@MIT.EDU
Stewart Gebbie wrote:
>
> I am running on Linux and I tried what you suggested with the extern...
> It did compile now but gave no out put on the syslog. Whereas when I compile
> with just g++ it works fine.
>
I took a look at the syslog.c file in the pthreads distribution and it
contains this interesting looking fragment in openlog:
if (LogStat & LOG_NDELAY) {
LogFile = socket(AF_UNIX, SOCK_DGRAM, 0);
flags = fcntl(LogFile, F_GETFD);
fcntl(LogFile, F_SETFD, flags & O_NONBLOCK);
}
So... you might try this:
int main(void)
{
openlog("MyProg",LOG_PID|LOG_NDELAY,LOG_USER);
syslog(LOG_USER|LOG_DEBUG|,"[%lx,%s:%d]
%d:%s",0,__FILE__,__LINE__,123,
"blaa");
closelog();
return 0;
};
--
Larry V. Streepy, Jr.
Chief Technical Officer, Healthcare Communications, Inc.
mailto:streepy@healthcare.com
(214) 851-7033 (Dallas Main #)
(970) 626-5028 (My office #) (970) 626-4425 (Fax)