logger.Outlet: WriteEntry must not block

- make TCPOutlet fully asynchronous, dropping messages if connection is
  not fast enough
- syslog is just fine for now, local anyways
- stdout same thing

refs #26
This commit is contained in:
Christian Schwarz
2017-12-29 17:19:07 +01:00
parent 9a19615fd4
commit 839eccf513
6 changed files with 125 additions and 80 deletions
+16 -6
View File
@@ -27,6 +27,8 @@ Check out :sampleconf:`random/logging.yml` for an example on how to configure mu
jobs: ...
.. _logging-error-outlet:
.. ATTENTION::
The **first outlet is special**: if an error writing to any outlet occurs, the first outlet receives the error and can print it.
Thus, the first outlet must be the one that always works and does not block, e.g. ``stdout``, which is the default.
@@ -100,6 +102,11 @@ Formats
``encoding/json.Marshal()``, which is particularly useful for processing in
log aggregation or when processing state dumps.
Outlets
~~~~~~~
Outlets are the destination for log entries.
.. _logging-outlet-stdout:
``stdout`` Outlet
@@ -150,12 +157,6 @@ Can only be specified once.
``tcp`` Outlet
--------------
.. WARNING::
The TCP outlet is not fully asynchronous and blocks the calling goroutine when it cannot connect.
Currently it should only be used for local connections that are guaranteed to not fail / be slow.
This issue is tracked in :issue:`26`
.. list-table::
:widths: 10 90
:header-rows: 1
@@ -197,6 +198,15 @@ This is particularly useful in combination with log aggregation services that ru
* - ``key``
- PEM-encoded, unencrypted client private key identifying this zrepl daemon toward the remote server
.. WARNING::
zrepl drops log messages to the TCP outlet if the underlying connection is not fast enough.
Note that TCP buffering in the kernel must first run full becfore messages are dropped.
Make sure to always configure a ``stdout`` outlet as the special error outlet to be informed about problems
with the TCP outlet (see :ref:`above <logging-error-outlet>` ).
.. NOTE::
zrepl uses Go's ``crypto/tls`` and ``crypto/x509`` packages and leaves all but the required fields in ``tls.Config`` at their default values.