scrive / log

Structured logging solution.
https://hackage.haskell.org/package/log-base
BSD 3-Clause "New" or "Revised" License
35 stars 7 forks source link

waitForLogger doesn't work as intended with the Elasticsearch back-end #6

Closed 23Skidoo closed 8 years ago

23Skidoo commented 8 years ago

Code fragment that illustrates the issue: https://github.com/scrive/log/pull/5/commits/abdd45fe9404db3fbc5bd5e50dc0d58307b449b5#diff-5ae59c4cdd155945a87b6ce91090551fR27

At least on my machine, I had to add calls to threadDelay after calls to logging functions to ensure that messages actually get written, even though I call waitForLogger before proceeding. Not sure yet whether the problem is on our or the Elasticsearch side.

23Skidoo commented 8 years ago

This looks like a feature of Elasticsearch: data becomes visible only after ~1 second. The way to fix this is to make waitForLogger use Elasticsearch refresh API: https://www.elastic.co/guide/en/elasticsearch/guide/current/near-real-time.html#refresh-api