You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/09/11 11:57:18 UTC

[GitHub] mikerhodes commented on issue #1373: Structured logging

mikerhodes commented on issue #1373: Structured logging
URL: https://github.com/apache/couchdb/issues/1373#issuecomment-420247812
 
 
   @iilyak  said:
   >> So "action: compaction_start" might be a useful one that these examples miss out.
   >
   > We definitely missed action field. How would you add it to API? Are you proposing to add into ExtraFields?
   
   Yes, I'd have it in extra fields. Not all log messages need it. Make it convention rather than enforced.
   
   @eiri said:
   
   > I think an action field is a good idea with one caveat that without formal naming strategy it's fairly simple to get a lot of inconsistencies in there and have for example starting_compaction in one place and compaction_start in another. 
   
   I can totally see this. I'd prefer to start with seeing if it's a problem in practice. Hopefully we are not starting the same process in many places 😄 
   
   > I personally don't think that's the case, with a message log("Starting compaction for shard ~p on update sequence ~p", [<<"shard">>, 12]) it would be helpful to have an ability to query by shard field, much less so for update_sequence field.
   
   That's a really good point. Looking at other things I've used in the past, they do split up the idea of the format args for the message from the extra structured fields args. 
   
   I think @iilyak's proposal takes that into account:
   
   ```
   couch_log:error("Compaction started for ~p", [shard], #{
        user => "foo", 
        shard => "shards/..."
   }).
   ```
   
   I, at least, found this a very readable code stanza.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services