Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm running Debian wheezy. Many scripts in /etc/init.d/ use various logging functions defined in the Linux Standard Base, like log_success_msg and log_warning_msg. The LSB documentation seems a bit ambiguous as to exactly what these functions should do:

The log_success_msg function shall cause the system to write a success message to an unspecified log file. The format of the message is unspecified. The log_success_msg function may also write a message to the standard output.

However, I guess this is interpreted as meaning that the functions can either write to a log file or just write to standard output. It seems that on Debian at least, it just causes a message to be written to standard output. My suspicions were confirmed when I checked out the file defining these functions, /lib/lsb/init-functions - it just calls echo to display any log message.

This is not helpful behaviour. Text written on boot to standard output disappears shortly after boot is complete, and may well scroll off the top of the screen in any case. Surely it would be far more helpful if these messages were actually stored in a log file; in fact I don't even see the point of logging anything via these functions if they are only going to go to standard output.

Is there any way to get these logs going to a file? Can anyone enlighten me as to why you would bother "logging" anything only to standard output? What helpful function does it serve?

share|improve this question
    
My reading of that is that logging the message to disk is mandatory, and repeating it to stdout is an optional extra. If you're right about the Debian behaviour, it looks to me as if Debian is not compliant. –  James Youngman Jul 12 '12 at 7:02
add comment

2 Answers

up vote 4 down vote accepted

It looks like the solution is to install bootlogd and put

BOOTLOGD_ENABLE=yes

in /etc/default/bootlogd.

References:

share|improve this answer
1  
Thanks, this worked nicely! They actually changed it from Debian squeeze to wheezy. In squeeze, bootlogd was installed by default and you just had to edit /etc/default/bootlogd and set BOOTLOGD_ENABLE=yes. In wheezy, they moved bootlogd into a separate package so you install the bootlogd package; with that package installed, it always logs boot output to /var/log/boot, and you don't need to edit any config file. –  Jez Jul 11 '12 at 17:43
add comment

No. It means that it must write to a log file. It may also print to the screen. The file is up to you. The message & format is up to you.

You'll have to look more in the LSB documentation to see how you're supposed to declare the log file that log_*_msg will use (although Mikel's answer likely works).

share|improve this answer
    
Except that it doesn't appear to write to any log file... so are you saying Debian violates the LSB docs? –  Jez Jul 11 '12 at 17:42
    
Did you provide it a log file to write to? –  bahamat Jul 11 '12 at 18:09
    
Where would you provide it? –  Jez Jul 11 '12 at 18:31
    
Like I said before, you have to keep looking in the LSB documentation for where/how. –  bahamat Jul 11 '12 at 18:38
    
Not much of an 'answer' then. :-) "Look at the docs to find out..." –  Jez Jul 11 '12 at 18:51
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.