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

Jeff Schroeder jeffschroed at gmail.com
Mon Jul 14 19:26:37 UTC 2008


On Mon, Jul 14, 2008 at 12:24 PM, Perry N. Myers <pmyers at redhat.com> wrote:
> Jeff Schroeder wrote:
>>
>> On Mon, Jul 14, 2008 at 11:57 AM, Chris Lalancette <clalance at redhat.com>
>> 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.
>>>  That way, if you see you have a [ FAIL ], you at least have an
>>> opportunity to
>>> debug it.  The other advantage is that you don't have redirects littered
>>> throughout the code for each individual line, and new code (if and when
>>> we need
>>> it) automatically get logged to the appropriate place.
>>>
>>> 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.
>>
>> My take it it should actually use syslog(3) which by default sends it
>> to /var/log/messages.
>> Instead of using output redirection, can you use logger(1)? Even if
>> you insist on a seperate
>> logfile, it will do these things for you with "-f".
>>
>> When you've built out a sizable syslog infrastructure accross your
>> datacenters,
>> it is nice when important applications such as ovirt actually use it.
>>
>> For shell scripts, something like:
>> logger -t ovirt-init -p daemon.$level "message"; exit $RETVAL
>> ...
>> logger -t ovirt-init -p daemon.warn "Ovirt starting"
>> logger -t ovirt-init -p daemon.error "Can not start daemon for some
>> reason"
>>
>> # Not tested, just typed into gmail's web interface.
>> function log() {
>>    level=$1
>>    shift
>>    message="$*"
>>    logger -t ovirt-init -p daemon.$level "$message"
>> }
>> ...
>>
>> Called via something like:
>> log warn "This is a warning from ovirt-init"
>>
>> If you wanted to be really fancy, put a case statement towards the bottom
>> of the log function that would exit on crit, emerg, panic, and error
>> levels.
>>
>> What do you think of that?
>>
>
> I like the idea of using logger for info/error/warning messages, but the
> primary purpose of the /var/log/ovirt.log file is really for ease in
> debugging...  i.e. we want to be able to capture the output (fairly verbose)
> of ovirt-identify-node and other programs that are running.  Not sure if
> that kind of verbose output belongs in /var/log/messages.
>
> Might make sense to do what Darryl's patch is doing for use in debugging,
> but still use a few calls to logger in the init scripts so that important
> messages get logged that way.

Agreed

> Perry


-- 
Jeff Schroeder

Don't drink and derive, alcohol and analysis don't mix.
http://www.digitalprognosis.com




More information about the ovirt-devel mailing list