Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Oct 2004 14:23:42 -0700 (PDT)
From:      "Richard Lynch" <ceo@l-i-e.com>
To:        freebsd-questions@freebsd.org
Subject:   stdout/stderr/???
Message-ID:  <1315.67.167.52.21.1097357022.squirrel@www.l-i-e.com>

next in thread | raw e-mail | index | archive | help
I have a situation where NIC code printf's out stuff.

I'd *LIKE* to collect that output.

Under Linux, I'd use 2&>1

I read somewhere that under FreeBSD, I could do:
(xxx > log.out) &> log.err

This works fine for xxx == make buildkernel

If fails miserably for xxx == ifconfig, however.

I can sorta get what I want by starting X-Windows, and using a
terminal/shell to do the command.  Then the messages I desire to log are
A) suppressed from by shell (which is BAD) but B) logged into
/var/log/messages (which is close enough to what I want)

Alas, the real problem comes when my driver code sends the machine into an
infinite loop, spewing out messages so fast I can't even read them, and
the only way out is to forcibly power-off the laptop by removing battery
and power cord.

Upon re-boot, the additions I would expect in /var/log/messages (or the
bziped older logs) do not contain the messages I need to see.

I have also tried:
ktrace xxx

Again, for the case where the machine is not in an infinite loop, it works
real nifty;  But when I'm forced to chop power, I get nothing.

Is there something that will:
A) copy (or re-direct) all output somewhere, *AND*
B) force it to be synchronous and unbuffered and whatever else has to
occur to get the file to be saved?

Any other suggestions for how to get this process to not lock up the machine?
control-C ineffective
CTRL-ALT-F2 followed by CTRL-ALT-DELETE can sometimes get me to another
tty, but that tty does not accept input

Hmmmm.  Perhaps I should try to cron a "killall ifconfig" for shortly
after the command I'm about to type...  Or something like:

ifconfig ...&; sleep 3; killall ifconfig

Any other ideas?

Please cc me, I'm so far behind on reading -questions that I've
unsubscribed until I catch up...

-- 
Like Music?
http://l-i-e.com/artists.htm



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1315.67.167.52.21.1097357022.squirrel>