[Ovirt-devel] [PATCH] Redirecting all logs to /var/log/ovirt.log

Darryl L. Pierce dpierce at redhat.com
Mon Jul 14 19:08:31 UTC 2008


Chris Lalancette wrote:
> Darryl L. Pierce wrote:
>> Given how short our scripts are, I don't see a benefit to inserting a 
>> method in between the entry point and the functionality.  However,I do 
>> like the failure notice as opposed to just exiting the script. So I've 
>> pulled that into the script and replaced all calls to die "message" with:
>>
>> function start () {
>> 	wget -q -o "some url" || echo "message" && return 1
>> }
>>
>> I'll have a patch out shortly once I run through tests.
> 
> I think what Perry is trying to get at is that it would be nice to both display
> an [ OK ] or [ FAIL ] message at the console (like all of the other init scripts
> do), but to also put more verbose output into a logging directory for debugging.

Sorry, guess I wasn't clear: I did get the above and that's in there. 
The basic structure is:

function start () {
     ...
     do_something_useful || echo "I failed" && return 1
     ...
}

case "$1" in
     start)
         echo -n $"Starting ovirt-early: "
         {
         start
         } >> $OVIRT_LOGFILE 2>&1
         test $? == 0 && success || failure
         ;;
esac

With the above structure, any function where we previously called "die" 
it instead echoes and returns 1. This avoids the script existing at the 
point of failure and passes control to the test line after the call to 
start. And that test will print either [OK] or [FAILED] depending on 
whether the function exited cleanly or returned a 1.

> Oh, one other nit-pick from me; I would name the log something like
> /var/log/ovirt-init.log, to make entirely clear it is the output from the init
> scripts.

I can see it either way. One thing we can do, if there's a concern, is 
inject a "Starting early/setup/post phase" line rather than having 
multiple logs as a delimiter.

-- 
Darryl L. Pierce, Sr. Software Engineer
Red Hat, Inc. - http://www.redhat.com/
oVirt - Virtual Machine Management - http://www.ovirt.org/
"What do you care what other people think, Mr. Feynman?"




More information about the ovirt-devel mailing list