Date: Fri, 01 Sep 2000 23:26:33 +0100 From: Brian Somers <brian@Awfulhak.org> To: Alexander Maret <maret@atrada.net> Cc: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.org>, brian@Awfulhak.org Subject: Re: Redirect stdout/stderr to syslog [OFF-TOPIC] Message-ID: <200009012226.e81MQY716346@hak.lan.Awfulhak.org> In-Reply-To: Message from Alexander Maret <maret@atrada.net> of "Fri, 01 Sep 2000 13:58:56 %2B0200." <58A002A02C5ED311812E0050044517F00D25DA@erlangen01.atrada.de>
next in thread | previous in thread | raw e-mail | index | archive | help
> Hi, > > I wonder if it is possible to redirect stdout/stderr to syslog. > > Background: > I'm writing a program which starts (fork=>execvp) and observes > another program. I would like to redirect all output of the "execvped" > program to syslog. > > I know this is not really FBSD related but I hope you can help > me anyway. Please don't tell me that I should redirect the output > to a file and not to syslog. I know how to redirect the output to > a file (that's my prog doing at present state). I guess you could do something like: int fd; fd = open(_PATH_DEVNULL, O_RDONLY); dup2(fd, STDIN_FILENO); close(STDOUT_FILENO); openlog(....); dup2(STDOUT_FILENO, STDERR_FILENO); > Bye, > Alex -- Brian <brian@Awfulhak.org> <brian@[uk.]FreeBSD.org> <http://www.Awfulhak.org> <brian@[uk.]OpenBSD.org> Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009012226.e81MQY716346>