[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Log handling



I thought this change (r30645) in debian-installer-utils was worth
mentioning:

  * Sending output to the syslog from shell has long been a bit nasty in
    d-i. We can pipe things to logger, but that loses the program's exit
    code. Add log-output to fix this; you give it a tag, a program name, and
    the program's arguments, it runs that program sending the output to
    syslog with the specified tag, and then exits with the same exit code as
    the subsidiary program.

At the moment we have a sort of random mix of log messages written to
/var/log/messages and log messages sent to syslog. Generally we write
things to /var/log/messages when they come from a program whose exit
code we care about and so it was awkward to pipe its output to logger
(because shell semantics mean you lose the exit code in that case).
That's hardly obvious to users in a lot of cases, though, and it means
that for many problems we have to ask for both log files; we've also had
a number of annoying and hard-to-spot bugs where some udeb overwrites
/var/log/messages rather than appending to it.

The intent of log-output is that you can do something like this instead:

-       if ! chroot /target /sbin/update-grub -y >> $log 2>&1 ; then
+       if ! log-output grub-installer chroot /target /sbin/update-grub -y; then

Once di-utils 1.13 makes it into initrds, I'd like to start converting
udebs to use this. I think it would be reasonable to leave just the
debootstrap log in /var/log/messages so that it shows up on tty3, and
send pretty much everything else to tty4.

Comments?

Cheers,

-- 
Colin Watson                                       [cjwatson@debian.org]



Reply to: