Dismantle the global log severity file

Goal & motivation

Logs are commonly used to diagnose and troubleshoot system state, whether in production or in tests.

A useful feature of logs in tests allows restricting log severity under test. This gives test authors the confidence that their test isn’t encountering unexpected erroneous conditions, even though all expectations set by the test are being met. Experience has shown that this is a useful feature that detects subtle bugs and regressions.

By default, tests will fail if they log at severity level greater than WARNING, meaning logs at ERROR or above. To override this behavior, developers can set a higher threshold. For instance if ERRORs are expected then developers will set max_severity = "ERROR" in the test specification associated with the test.

When this feature was first introduced, all overrides were set in a single file. Since then it became possible to set the override specific to the test where the test itself is defined. The new approach is easier to maintain.

Technical background

Entry-level knowledge of editing BUILD.gn files is required.

How to help

Picking a task

Pick an entry from max_severity_fuchsia.json. For instance:

  1. {
  2. "url": "fuchsia-pkg://fuchsia.com/logging-cpp-tests#meta/logging_cpp_unittests.cmx",
  3. "max_severity": "FATAL"
  4. },

You’ll be deleting this part, and setting a similar configuration where logging_cpp_unittests.cmx is used as needed.

Doing a task

Find the definition for the associated test, such as by looking for a BUILD.gn file that includes the strings "logging-cpp-tests" or "logging_cpp_unittests.cmx". Add the max_severity setting to mirror what you deleted from max_severity_fuchsia.json, according to the guide.

Completing a task

Find reviewers by OWNERS and merge your change.

Examples

Sponsors

Reach out for questions or for status updates: