Logging also stderr in verbose mode ?

Ronan KERYELL Ronan.Keryell at enst-bretagne.fr
Tue Apr 2 13:48:19 CEST 2002


Verbose mode is great but only stdout is logged and I've spent some time
to figure out what was happening... :-(

Example showing the difference between rcS.log :
chroot /tmp/target apt-get -y --purge remove pcmcia-cs ppp pppconfig pppoeconf
Reading Package Lists...
Building Dependency Tree...
E: Package pppoeconf is not installed
ERROR: 25600 25600
chroot /tmp/target dpkg --set-selections < /tmp/target/tmp/dpkg-selections.tmp
chroot /tmp/target apt-get -y dselect-upgrade

and software.log :
chroot /tmp/target apt-get -y --purge remove pcmcia-cs ppp pppconfig pppoeconf
Reading Package Lists...
Building Dependency Tree...
chroot /tmp/target dpkg --set-selections < /tmp/target/tmp/dpkg-selections.tmp
chroot /tmp/target apt-get -y dselect-upgrade

Well not so easy in subroutines... :
    elif [ "$verbose" ]; then
	yes '' | install_packages | tee -a /tmp/software.log
    else
	yes '' | install_packages >> /tmp/software.log 2>&1
    fi

Interesting shell challenge... :-)
Using 2 'tee -a /tmp/software.log', one for stdout and the other for
stderr ?
-- 
    Ronan KERYELL              |\/
    Labo Informatique Télécom  |/)  Tel:    (+33|0) 2.29.00.14.15
    ENST Bretagne, BP832       K    Fax:    (+33|0) 2.29.00.12.82
    29285 PLOUZANE CEDEX       |\   E-mail: Ronan.Keryell at enst-bretagne.fr
    FRANCE                     | \  http://www-info.enst-bretagne.fr/~keryell



More information about the linux-fai mailing list