Component Architecture#
mw::log Backend Architecture
|
status: draft
security: NO
safety: ASIL_B
|
||||
Overview#
The mw::log Backend writes the log records created by the Log Frontend
(score_baselibs) to an output channel: the Datarouter (remote/DLT), the
system logger (syslog on Linux, slog on QNX), a local file or a custom backend.
Description#
The backends are selected in two steps. At build time, the application links
the backends it needs, and each linked backend registers itself for a
LogMode before main(). At runtime, the logging configuration of the
application selects the LogMode values, and a recorder is created for each
of them that has a registered backend.
A recorder turns the log calls of a LogStream into a log record, and its
backend owns the slots that hold the records and writes a finished record to
the output channel. The remote/DLT backend hands the records over to
comp__datarouter through a shared-memory ring buffer
(Log Record Shared-Memory (logic_arc_int__logging__shared_memory)) and uses a separate control
channel to connect to it (Control Channel (logic_arc_int__logging__datarouter_msg_client)).
Design decisions:
Recorder and backend are separate abstractions, so a new output channel only needs a new backend.
Logging does not block the application: slots are reserved without time-unbound locks, and a record that does not fit is dropped and counted instead of waited for.
Design constraints:
Heap allocation only during initialization, local allocators afterwards.
Syslog backend on Linux only, slog backend on QNX only.
The file backend is not intended for production use (it uses a mutex to drain the slots).
Datarouter outputs shall not be relied upon for safety goals: sizes of shared-memory entries, messages and notifications are limited and checked.
The detailed design of the units is described in mw::log Backend Detailed De... (doc__mw_log_backend_detailed_design).
Rationale Behind Architecture Decomposition#
The component is not split into lower level components. It is decomposed into
units by output channel (one recorder/backend pair per LogMode), so that
each unit has a single responsibility and can be selected and tested
independently. The units are described in the detailed design.
Note
Common decisions across components / cross cutting concepts is at the higher level.
Static Architecture#
mw::log Backend
|
status: valid
security: YES
safety: ASIL_B
|
||||
This is the logging component library responsible for selecting the appropriate log sinks based on configuration at runtime. It can perform tasks such as log formatting, filtering, and composite backend selection based on runtime context and configuration. The logging component is designed to be extensible, allowing for custom logging backend to be added as needed. |
|||||
mw::log Backend (Static View)
|
status: valid
security: YES
safety: ASIL_B
|
||||
|
|||||
Dynamic Architecture#
Log Call via DataRouter Recorder
|
status: valid
security: YES
safety: ASIL_B
|
||||
One verbose log call in remote/DLT mode: the
|
|||||
Connection Setup to Datarouter
|
status: valid
security: YES
safety: ASIL_B
|
||||
The remote/DLT backend connects to
|
|||||
Log Call via System Backend
|
status: valid
security: NO
safety: QM
|
||||
One log call in system mode on Linux: the
|
|||||
Interfaces#
Log Record Shared-Memory
|
status: valid
security: YES
safety: ASIL_B
|
||||
Shared-memory ring buffer carrying only serialized log records: the remote/DLT recorder
backend writes into it, and |
|||||
Control Channel
|
status: valid
security: YES
safety: ASIL_B
|
||||
|
|||||
Decision Records#
Explicit initialization of ... (dec_rec__logging__explicit_init)