Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mira.net.au!news.netspace.net.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!news.apfel.de!fu-berlin.de!irz401!orion.sax.de!uriah.heep!news From: j@uriah.heep.sax.de (J Wunsch) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Redirecting syslog to parallel printer: best way? Date: 15 Jun 1997 17:27:58 GMT Organization: Private BSD site, Dresden Lines: 50 Message-ID: <5o18mu$876@uriah.heep.sax.de> References: <macwhiz-ya023680001306972234310001@news.accinet.net> Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) NNTP-Posting-Host: localhost.heep.sax.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: knews 0.9.6 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:42859 macwhiz@phoebe.accinet.net (Rob Levandowski) wrote: > Not all of the log gets printed. Occasionally, some lines are skipped -- > particularly if several lines are logged quickly. This probably means your printer handshake doesn't work. I've got the same setup running (i think it's also an old retired Okiline), and the biggest problem i've got is just the other way round: the handshaking works too well, and if the printer runs out of paper for sufficiently long time, it blocks syslogd, and for some unknown reason, stalls the entire system. (It's an older FreeBSD however.) > My first configuration simply had a syslog.conf entry that was directed to > /dev/lpt0. I discovered that this wasn't a good solution, because it > didn't deal well with newsyslog. What do you expect from newsyslog with a hardcopy device? There's nothing it needs to handle. /dev/lpt0 is just in the same boat as /dev/console. > Surely there's a better way! Ideally, I'd find a version of syslog that > was designed for printer logging. However, any solution that will work > with an virtually unbuffered parallel port printer is welcome. (Note, > however, that the log must be emitted in realtime -- I don't want to batch > this up a page at a time using lpr, or somesuch.) The only way out of the buffering dilemma (in which i am, too) would be to run FreeBSD 2.2 or higher, and use the new piping capabilities of syslogd. I wrote them, somewhat featured after IRIX, but in a different (and i think, more effective) implementation. The only drawback is, i avoided the stalling problem (which was a real problem in the setup i've been writing this feature for) by making the pipe IO nonblocking. This means, your buffering process must be able to buffer enough of data, or it will lose some. I felt this was much better than endangering a stalling syslogd. Note that if you wanna do it this way, the piped-to process will be started delayed, once a message arrives for it. It can either volunteerely exit at any time, and will be respawned as needed, or syslogd will send a SIGTERM after (i believe) two mark intervals, i.e. 40 minutes. The process should catch the SIGTERM and flush its buffers if necessary. (It will be sent a SIGKILL one mark interval later, if it still didn't exit yet.) -- 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. ;-)