From 9d2e5dea6deb0f1eb8edb2d94ba7b0deecca5c0c Mon Sep 17 00:00:00 2001 From: Prashant Varanasi Date: Thu, 12 Nov 2020 13:59:12 -0800 Subject: [PATCH] Add FAQ question on zap dropping logs due to sampling (#875) Multiple issues have been opened about missing logs (e.g., #874, #588). While sampling is mentioned in the API documentation for `NewProductionConfig`, it may help to add an FAQ question as well. --- FAQ.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FAQ.md b/FAQ.md index 5ec728875..626bda978 100644 --- a/FAQ.md +++ b/FAQ.md @@ -27,6 +27,13 @@ abstraction, and it lets us add methods without introducing breaking changes. Your applications should define and depend upon an interface that includes just the methods you use. +### Why are some of my logs missing? + +Logs are dropped intentionally by zap when sampling is enabled. The production +configuration (as returned by `NewProductionConfig()` enables sampling which will +cause repeated logs within a second to be sampled. See more details on why sampling +is enabled in [Why sample application logs](https://github.com/uber-go/zap/blob/master/FAQ.md#why-sample-application-logs). + ### Why sample application logs? Applications often experience runs of errors, either because of a bug or