mw::log Component Requirements#

Logging Component Requirements
status: valid
security: YES
safety: ASIL_B
version: 0

Log and Trace#

Log and Trace Framework consists of logging libraries and datarouter. The applications use logging libraries to write logs. datarouter implements logging daemon functionality, and can forward log messages from applications as DLT messages.

Use Log and Trace Framework
status: valid
security: NO
safety: QM
reqtype: Functional
version: 0

All output from logging and instrumentation based logging shall go through “mw::log” framework.

mw::log#

Avoid Signal Processing
status: valid
security: YES
safety: ASIL_B
reqtype: Functional
version: 0

The component shall not register any signal handler.

File Descriptor Flags
status: valid
security: YES
safety: ASIL_B
reqtype: Functional
version: 0

The component shall set the FD_CLOEXEC (or O_CLOEXEC) flag on all the file descriptors it owns.

Note: This requirement can be satisfied in unit-test, by checking int flags = fcntl(fd, F_GETFD); assert((flags != -1) && (flags & FD_CLOEXEC)); for every file descriptor owned by the component.

DLT Verbose Mode
status: valid
security: NO
safety: QM
reqtype: Functional
version: 0
belongs to: comp__logging

mw::log shall implement DLT verbose mode. Generation of messages shall be done in DLT-conform format, allowing messages to be sent by Datarouter without additional reprocessing.

AUTOSAR Log and Trace Specification
status: valid
security: YES
safety: QM
reqtype: Functional
version: 0

mw::log shall implement “Specification of Log and Trace for Adaptive Platform”. Release of specification used shall be in agreement with the rest of Adaptive AUTOSAR stack.

Send Messages to Datarouter
status: valid
security: NO
safety: QM
reqtype: Functional
version: 0

mw::log shall use logging library to send verbose messages to datarouter. Applications shall use mw::log interface to log verbose mode messages. Internally mw::log shall be using logging library.

Inactive LogStream Behavior
status: valid
security: NO
safety: QM
reqtype: Functional
version: 0

mw::log library shall not perform any useful activity if log level of LogStream object is insufficient for given context. LogStream object shall not generate serialized messages if the severity of the message does not allow it to be sent.

Shared Memory File Permissions
status: valid
security: YES
safety: ASIL_B
reqtype: Functional
version: 0

Logging shared-memory files shall have read-only posix file permission for group and others. The shared-memory file created by mw::log shall be read-only for group and others.

Note: mw::log creates a shared memory file for each app.

System Backend#

System logger backend shall forward the logs to the native system logger.

Forward to System Logger
status: valid
security: NO
safety: QM
reqtype: Functional
version: 0

The system logger backend shall forward the logs to the native system logger mechanism.

Note: Under QNX, slogger2 shall be used.

System Backend Activation
status: valid
security: NO
safety: QM
reqtype: Functional
version: 0

The system logger backend shall be enabled if and only if the log mode contains “kSystem”.

Non-Functional Requirements#

Local Allocation Strategy
status: valid
security: YES
safety: ASIL_B
reqtype: Non-Functional
version: 0

mw::log shall use local allocators to avoid using global heap. Global heap allocation (if any) shall be limited to initialization phase of application lifecycle.

No Endless Loops
status: valid
security: YES
safety: ASIL_B
reqtype: Non-Functional
version: 0

mw::log shall not contain unbound loops or loops with unchecked exit conditions.

Avoid Locks
status: valid
security: YES
safety: ASIL_B
reqtype: Non-Functional
version: 0

mw::log shall be free of time-unbound locks and shall implement strategies to limit wait time. Time limit shall be defined based on requirements from functions on individual ECU. Mutual exclusion mechanisms shall include priority inversion protection.

Cross-Locking Prevention
status: valid
security: YES
safety: ASIL_B
reqtype: Non-Functional
version: 0

Cross-application and cross-thread dependencies shall be avoided. A thread logging in a loop shall not block other thread’s execution.

Index and Size Checking
status: valid
security: YES
safety: ASIL_B
reqtype: Non-Functional
version: 0

Indices in data structures and sizes of data accessed or copied shall be checked for plausibility to avoid high runtime utilization through long iterations or data corruption.

Memory Bound Checking
status: valid
security: YES
safety: ASIL_B
reqtype: Non-Functional
version: 0

Memory boundaries shall be explicitly checked when writing to shared memory.