
Recall first from Error handling and the Linux backend
- A missing key can justify a default when the application explicitly allows it.
- A read-only access condition and a Linux read-only filesystem describe different layers.
- The vendor implementation and deployment determine the backing format and storage path.
What DLT sends
3 min readThe last lesson ended with data stored in files. This lesson answers how DLT logs and traces it, and how levels and contexts structure the output.
A maintenance engineer investigating a sensor timeout needs to know which program reported it. On a Linux ECU, the program that reads the sensor and the program that consumes its data can both report a timeout. Searching the message text can find both reports. Source identifiers let the engineer select the sensor reader and then narrow the view to reports from its sampling code. This kind of structured collection is what the open-source DLT implementation provides. The project originated under GENIVI and is now maintained under COVESA. COVESA DLT daemon project
DLT stands for Diagnostic Log and Trace. The DLT protocol defines how messages are represented so that a producer and a receiver can agree on where fields begin and what they mean. dlt-daemon is the Linux process in the COVESA implementation that collects messages from local DLT-enabled programs and can forward them to a diagnostic client. DLT Viewer is one such client. On Linux, a client can connect to the daemon through a TCP socket. TCP delivers an ordered stream of bytes, and the DLT message length tells the reader where each message ends within that stream. Linux socket interface, TCP stream semantics
The following layout describes DLT protocol version 1, as in the AUTOSAR Log and Trace Protocol Specification (version 1 document, release R20-11) and in the COVESA dlt-daemon. The R24-11 foundation specification defines protocol version 2 and refers to the version 1 document separately. The the required header at the start of a DLT message contains a header-type byte, a message counter, and a length field. The header-type byte identifies the protocol version and signals which optional header fields are present. Depending on those flags, the standard header can also carry an ECU ID, a session ID, or a timestamp. The length covers the standard header, the extended header when present, and the payload. A decoder reads the header flags before trying to locate the payload because the optional fields affect where the payload begins.
When the standard header indicates an extended header, that header carries the message information field, an argument count field, the application ID, and the context ID. The message information field includes the message type, the subtype, and a flag that indicates verbose encoding. The payload holds the content. A log payload can describe what happened with text and values, a network trace can contain captured communication data, and a control message can carry a request or its response. The receiver needs the header information to interpret the payload correctly.
Consider what the receiver can learn before it reads the content of a log entry. The standard header gives the message length. With the extended header present, the receiver can identify the application and context and read the severity encoded in the log subtype. This makes it possible to select a subset by source and severity without looking for words such as “timeout” or “failed” in the payload. The displayed text can then describe the operation and its result in terms that are useful to the person investigating it.
How application IDs and contexts identify the source
3 min readAn ECU ID identifies the reporting electronic control unit. An application ID, abbreviated APID, identifies a DLT application within that ECU. A context ID, abbreviated CTID, identifies a logical source within the application. In DLT version 1, the application and context ID fields in the extended header are each four bytes wide. An ID such as SENS or ACQ is a short identifier chosen for the software. A readable description such as “Sensor acquisition” can explain what the context covers.
Consider a sensor service whose application ID is SENS. Its ACQ context covers acquisition, including configuring the sensor and reading samples. Its PUB context covers publishing readings to consumers. Both contexts belong to the same application. A timeout while waiting for a sample belongs to ACQ, while a timeout encountered while publishing a reading belongs to PUB. In both cases an operator might search for the same word, but selecting the context identifies which operation to investigate.
Another application on the same ECU can also use PUB for its own publishing code. If its application ID is DISP, the two sources are distinguished by SENS with PUB and DISP with PUB. A filter on PUB alone can include both. If the same application is deployed to two ECUs and uses the same identifiers on each, the ECU ID further qualifies the source wherever the ECU identity is available. For example, ECU1 with SENS and PUB identifies a different source from ECU2 with SENS and PUB. These identifiers are illustrative field values.
A context names a function or area of code. Acquisition may report an Info message when it starts, a Warn message when a read needs a retry, and an Error message when a read ultimately fails. All three can come from ACQ. The context tells you where each event occurred, and the level tells you how the producer classified it. Code running on different threads can use the same context when it reports the same logical activity. Consequently, finding ACQ in an entry tells you which activity reported it. Identifying a specific thread would require separate information.
The context also gives the logging system a scope for its level setting. If the problem occurs during acquisition, the system can allow Debug messages from SENS and ACQ while requiring Warn or higher severity from SENS and PUB. This lets the operator see acquisition details without increasing the amount of routine publishing output. The remaining question is how DLT decides whether an individual entry passes that setting.
How message types and log levels work
4 min readThe message type identifies what kind of information a DLT message carries. In the version 1 extended header, the subtype has a meaning within that type. For the log type, it identifies severity. For a control message, it can identify a request or a response. A decoder therefore looks at the type before interpreting the subtype. The main categories are:
| Message type | What it carries | Example use |
|---|---|---|
| Log | A program event with a severity | Report a sample read failure |
| Application trace | Trace data about application activity | Record a function entry or exit |
| Network trace | Trace data from a communication interface | Record communication data associated with a CAN frame |
| Control | A DLT service request or response | Ask to change a context's log level or report the result |
A Debug message about an outgoing frame is a log. Captured communication data carried as a network trace is a network trace. They may concern the same operation, but each has its own type and subtype. DLT also distinguishes the Verbose log level, which describes how much detail an event represents, from the verbose encoding flag, which describes how the message content is represented. An Error log can use verbose encoding and still have Error severity. The lesson on DLT Viewer covers how the encoding affects what a client can display.
DLT defines six event levels. Here they are ordered from the most detail to the most severe. The examples use the sensor service to give each level a concrete meaning.
| Level | Typical meaning | Sensor service example |
|---|---|---|
| Verbose | Fine-grained detail | Record each intermediate value in sample conversion |
| Debug | Detail for investigating program behavior | Record why a read is being retried |
| Info | An expected event worth recording | Report that sampling has started |
| Warn | An abnormal condition the program can handle | Report that the first read failed and a retry succeeded |
| Error | A failed operation or service function | Report that the read failed after retries and the sample was discarded |
| Fatal | A critical failure that prevents continued operation | Report that the service cannot continue because its required device is unavailable |
The producer chooses the severity according to the effect on the program or service. For instance, one missing sample could be a Warn if the service substitutes a reading and continues as designed. The same missing sample could be an Error if the service has to discard the current result. Selecting Fatal records a critical failure. Any decision to return, stop, or exit comes from the program's error handling.
A the least severe log level admitted for a context when log output is enabled includes the selected level and all more severe levels. A context set to Warn admits Warn, Error, and Fatal. A context set to Debug also admits Info and Debug, leaving out Verbose. At Verbose, all six event levels pass. Off is a setting that disables log output for the context. DLT handles trace enablement separately from the log level.
Suppose SENS uses a Debug threshold for ACQ and a Warn threshold for PUB. An Info event about sampling starting passes in ACQ. An Info event about publishing starting is below the threshold in PUB. An Error reporting a publishing failure passes in PUB even while its routine Info messages are suppressed. Lowering PUB to Info makes future Info events eligible for emission. If the earlier publishing event was suppressed at the source, a display filter on the client has no record of it to show.
The next lesson, The dlt-daemon and the client library, explains how a Linux program supplies its application ID and contexts to the DLT implementation and how its messages reach the daemon.
Key takeaways
- DLT version 1 messages have a standard header, an extended header when indicated, and a payload.
- An application ID identifies the producer within an ECU, and a context ID identifies a source within that application.
- The message type determines what the subtype means.
- A log threshold of Warn admits Fatal, Error, and Warn for that context.
Reflect
- Explain to a colleague, in two sentences: describe the roles of the DLT protocol and dlt-daemon.
- Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
- What surprised you when you ran the commands yourself?
On a real board
Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.
References and further reading
Official documentation first. Links checked when the lesson was published.