[openstack-dev] Proposed Logging Standards

Ben Nemec openstack at nemebean.com
Fri Jan 31 16:00:56 UTC 2014


On 2014-01-31 07:00, Macdonald-Wallace, Matthew wrote:
>> -----Original Message-----
>> From: Sean Dague [mailto:sean at dague.net]
>> Sent: 31 January 2014 12:29
>> To: OpenStack Development Mailing List (not for usage questions)
>> Subject: Re: [openstack-dev] Proposed Logging Standards
>> 
>> On 01/30/2014 07:15 PM, John Dickinson wrote:
>> > 1) Every log message is one line (ends with \n) and the log fields are
>> > space-delineated. eg (`log_line = ' '.join(urllib.quote(x) for x in
>> > log_fields_list)`)
> 
> +1 for this - multiple lines (even in in DEBUG mode!) are a PITA to
> handle with most log analyser software.
> 
>> 
>> > 2) The only definition of a log format is the prefix and the message is a set of
>> fields defined by the service actually doing the logging.
>> 
>> So, actually, most of my concern at this point wasn't the line format.
>> It was the concern about when projects were calling the loggers, and 
>> what kind
>> of information should be logged at each level.
>> 
>> Given that most projects are using the oslo defaults today, much of 
>> the line
>> format is handled. I think that if you have concerns on that front, 
>> it's probably a
>> different conversation with the oslo team.
>> 
>> I do agree we should standards a little more on project (i.e. logger 
>> "name"),
>> because in most projects this is just defaulting to module.
>> Which is fine for debug level, but not very user friendly at ops 
>> levels.
> 
> I'd just love to see the ability in the python logger to include the
> application name, not just the class/module that created the log
> message (it's in 3.<something> but I don't think we can justify a
> switch to Python 3 just based on logging!):
> 
> <datetime> <LEVEL> <PID> <PROGRAM-NAME (i.e. nova-compute)> <module>
> <stuff> <more_stuff> <even_more_stuff>
> 
> At the moment, all of the above is possible except for the
> <PROGRAM_NAME> part.  Is there anything we can do to add this to the
> context or similar?
> 
> Matt

Wish granted. :-)

https://github.com/openstack/oslo-incubator/commit/8c3046b78dca8eae1d911e3421b5938c19f20c37

The plan is to turn that on by default as soon as we can get through the 
deprecation process for the existing format.

Related to John's comments on the line format, I know that has come up 
before.  I gather the default log format in Oslo started life as a 
direct copy of the Nova log code, so there seem to be some nova-isms 
left there.  I'm open to suggestions on how to make the default better, 
and probably how to allow each project to specify its own default format 
since I doubt we're going to find one that satisfies everyone.

-Ben



More information about the OpenStack-dev mailing list