[openstack-dev] Log / error message format best practices & standards

Sean Dague sean at dague.net
Sat Jun 28 13:59:57 UTC 2014


On 06/28/2014 09:41 AM, Matt Riedemann wrote:
> 
> 
> On 6/26/2014 1:54 PM, Jay Pipes wrote:
>> On 06/26/2014 12:14 PM, boden wrote:
>>> We were recently having a discussion over here in trove regarding a
>>> standardized format to use for log and error messages - obviously
>>> consistency is ideal (within and across projects). As this discussion
>>> involves the broader dev community, bringing this topic to the list for
>>> feedback...
>>>
>>> I'm aware of the logging standards wiki[1], however this page does not
>>> describe in depth a standardized format to use for log / error messages.
>>>
>>> In particular w/r/t program values in messages:
>>>
>>> (a) For in-line program values, I've seen both single quoted and
>>> unquoted formatting used. e.g.
>>> single quote: LOG.info("The ID '%s' is not invalid." % (resource.id))
>>> unquoted: LOG.info("The ID %s is not valid." % (resource.id))
>>
>> No opinion on this one.
>>
>>> (b) For program values appended to the message, I've seen various
>>> formats used. e.g.
>>> LOG.info("This path is invalid: %s" % (obj.path))
>>> LOG.info("This path is invalid %s" % (obj.path))
>>> LOG.info("This path is invalid - %s" % (obj.path))
>>
>> The first would be my preference (i.e. using a ": " to delineate the
>> target of the log message)
>>
>>>  From a consistency perspective, it seems we should consider
>>> standardizing a best practice for such formatting.
>>
>> Possibly, though this is likely getting into the realm of femto-nits and
>> bike-shedding.
> 
> Ha, you read my mind, i.e. bike-shedding.
> 
> There are a few wikis and devref docs on style guides in openstack
> including logging standards, I'd say make sure there is common sense in
> there and then leave the rest to the review team to police the logs in
> new changes - if it's ugly, change it with a patch.
> 
> We don't need to boil the ocean to develop a set of standards/processes
> that are so heavy weight that people aren't going to follow anyway.
> 
> This sounds exactly like the kind of thing I see a lot within the
> workings of my corporate overlord and it drives me crazy, so I'm a bit
> biased here. :)
> 
> FWIW, Sean Dague has a draft logging standards spec for nova here:
> 
> https://review.openstack.org/#/c/91446/

Yeh, I agree. I think stuff to that level of detail is just overkill.
Lets spend our energy on the bigger issues in logging first, and not
create a overreach rules that people are going to forget anyway.

	-Sean

-- 
Sean Dague
http://dague.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140628/854c8f19/attachment.pgp>


More information about the OpenStack-dev mailing list