Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Status

Status
colourBlue
titleCommentedAccepted

Stakeholders
Outcome

Jira
serverHyperledger JIRA
serverId6326cb0b-65b2-38fd-a82c-67a89277103b
keyIR-873

Due date
Owner

...

  1. Logs should be printed to stdout and stderr.
  2. Log-level (verbosity) should be changeable in runtime, example: system signal (e.g., SIGUSR1, SIGHUP) to reread configs(env variable)  and change the log-level.

Solution

Log macroses macros can log function arguments and result, using https://tools.ietf.org/html/rfc5424 or newer.  Nowadays de facto standard for log is JSON.

...

Code Block
DEBUG - 2020-08-04 08:09:40:759899847 - request[start]: 
DEBUG - 2020-08-04 08:09:40:759961514 - self = Client { public_key: PublicKey { digest_function: "ed25519", payload: "[1E, 0, 33, 8A, D, 96, B, B4, 4D, 9E, 7F, 3A, C1, 3C, A, 5D, 89, BF,
  31, 8A, F8, 76, E2, FD, 15, 50, EE, 28, C5, EE, 9E, 63]" }, torii_url: "127.0.0.1:45371" },

Decisions

Alternatives

  • Own implementation - are hard to maintain and time consuming in development with no guarantees about performance
  • Tracing libraries - very complicated, no need in current state but may be considered for future use (with back compatible logging format extension)
  • .
  • Provide a `/configure` endpoint for changing the log-level at run-time. The request should be provided in terms of a JSON file.
  • Each function should be instrumented to provide vital (determined on a case-by-case basis) information.
  • Errors must be either handled, or logged as `warn` or `error` level messages.
  • Use tracing_bunyan_formatter to provide efficient machine readable logging. The destination is set at run-time and log rotation is the administrator's responsibility.
  • Fields and their values should be recorded directly, preferably (unless otherwise specified), using their names in the source code.
  • Logging that is done unconditionally upon entering/exiting a function is given the TRACE level.
  • Logging that is done upon completion of some or part of a function is given a DEBUG level or higher.

Concerns

  • Implementation of loggers could affect performance (tracing is one of the fastest)
  • Log rotation can become an issue. Async actions will be hard to discover in a log file

Assumptions

  • We do not depend on any implementation, only on format

...