Monetillo
Monetillo

Reputation: 31

DLT log debug messages

I am using dlt in a c++ program I have. The code is this:

main.cpp:

#include <dlt/dlt.h>

#include <csignal>

#include "DltLoggerManager.h"
#include "./others_classes/FooClass.h"
#include <chrono>

void signalHandler(int signal)
{
    // Handle the signal, e.g., clean up and flush logs

    // Terminate the application
    std::exit(signal);
}

int main()
{
    
    DltLogger *logger = new DltLogger();

    std::this_thread::sleep_for(std::chrono::seconds(1));

    if(logger)
    {
        logger->logInfo("main", "test begin");
        logger->logDebug("main", "test debug ");
    }


    // When It gets a signal to close the program, It will call signalHandler
    std::signal(SIGINT, signalHandler);
    std::signal(SIGTERM, signalHandler);

    return 0;
}

DltLogger is in charge of registering the application and the context (I have tested it and that's why it is not a problem). If we look at the functions that write the messages, they are:

void DltLogger::logDebug(const std::string &name_function, const std::string &message)
{
    std::string msg = name_function + ". " + message;

    if (is_context_registered_)
    {
        DLT_LOG(context_, DLT_LOG_DEBUG, DLT_CSTRING(msg.c_str()));
    }
}

void DltLogger::logInfo(const std::string &name_function, const std::string &message)
{
    if (is_context_registered_)
    {
        std::string msg = name_function + ". " + message;
        DLT_LOG(context_, DLT_LOG_INFO, DLT_CSTRING(msg.c_str()));
    }
}

As you can see, I'm writing an info message and a debug message but I can't see the debug message in dlt-viewer. In dlt-viewer I have the log level set to verbose.

I have changed the configuration of the dlt.conf file (the one used by dlt-daemon) but I still can't see that message. In the configuration file, I changed "LoggingLevel" to 7 (debug) and "ContextLogLevel " to 5 (debug).

This what i see in dlt-viewer:

dlt-viewer info message

On the other hand, if I connect from DltViewer (button: connect all ECUs) I can see it.

Does anyone know what is going on?

Upvotes: 0

Views: 166

Answers (1)

Monetillo
Monetillo

Reputation: 31

I discovered that if i put: export DLT_INITIAL_LOG_LEVEL="::5"

It will enables the logs of debug.

Upvotes: 0

Related Questions