From owner-freebsd-hackers Fri Sep 1 5:28:11 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from sentinel.office1.bg (sentinel.office1.bg [195.24.48.182]) by hub.freebsd.org (Postfix) with SMTP id 544CF37B424 for ; Fri, 1 Sep 2000 05:28:06 -0700 (PDT) Received: (qmail 49376 invoked by uid 1001); 1 Sep 2000 12:24:43 -0000 Date: Fri, 1 Sep 2000 15:24:43 +0300 From: Peter Pentchev To: Alexander Maret Cc: "'freebsd-hackers@freebsd.org'" Subject: Re: Redirect stdout/stderr to syslog [OFF-TOPIC] Message-ID: <20000901152443.K46859@ringwraith.office1.bg> References: <58A002A02C5ED311812E0050044517F00D25DB@erlangen01.atrada.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <58A002A02C5ED311812E0050044517F00D25DB@erlangen01.atrada.de>; from maret@atrada.net on Fri, Sep 01, 2000 at 02:13:19PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Sep 01, 2000 at 02:13:19PM +0200, Alexander Maret wrote: > > -----Ursprungliche Nachricht----- > > Von: Peter Pentchev [mailto:roam@orbitel.bg] > > Gesendet: Freitag, 1. September 2000 14:00 > > > > man 1 logger > > > > pipe your stdout/stderr to logger(1), and you're all set. > > You may even > > specify a facility/level to log with. > > > > Thanks for your quick answer but I would prefer to > do it entirely in C without calling external progs. > I could think of a solution forking another child process > which does the syslog logging and redirecting stdout/stderr > of the execvped program via IPC to this child. > > But is there any easier solution? No, I don't think you can do anything cheaper than a fork and a pipe(2). popen(), as suggested in another message, is pretty much the same. I don't think stdio has a hook to capture all the data a process is sending to a stream, and pass it to some routine - that would be perfect, but unfortunately, I am not aware of such a thing. I might be wrong though. G'luck, Peter -- This sentence contradicts itself - or rather - well, no, actually it doesn't! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message