Command Line Log Tool is not working


#1

The log level filtering from the command line is not working using the below command:

$ log level INFO myProc/myComp

As per the 17.06 reference manual, Settings in the Log Control Daemon applied through log control tool has to override the environment variable settings when the process connects to the Log Control Daemon.

But log level Settings from the Log control Daemon is not overriding the Environment Variable log level settings.
In the below Example :
The Environment variable sets log level to INFO

envVars:
{
LE_LOG_LEVEL = INFO
}

When I change the log level to Error from command line using any of the below commands:

log level ERROR helloWorld/helloComponent
log level ERROR “/

The level changes are not reflected in System logs.The log level in system logs was INFO not ERROR

But when I do : log list

This is what I observed:
helloWorld
/* @ ERROR
/framework @ ERROR
/helloComponent @ ERROR
/helloWorld_exe @ ERROR
pid 3780
/framework @ ERROR
/helloComponent @ ERROR
/helloWorld_exe @ ERROR
But in systemlogs the log level was still INFO.

When no log level is configured in environment variable,the default log level “INFO” is taken but not taking the settings from log tool.

Can you please help on this?

Details:
Board: mangOH Green
Chip: WP85
Legato version: 17.06.0


#2

With the “log” tool, note the application name is used differently with small letters. You can get the info using the “app info” command

root@swi-mdm9x28:~# app info Legato_Logging
Legato_Logging
status: running
running processes:
legato_logging[10030] (10030)
app.name: Legato_Logging
app.md5: 66307acf09c83bfe76b8e5cfb1854e25
app.version: 1.0.0.20180102172619
legato.version: 17.09.0
root@swi-mdm9x28:~#
root@swi-mdm9x28:~# log list | grep logging
legato_logging
/legato_logging_exe @ DEBUG
/legato_logging_exe @ DEBUG
root@swi-mdm9x28:~# log level EMERGENCY legato_logging/*
Set filtering level for ‘legato_logging/*’ to ‘EMERGENCY’.
root@swi-mdm9x28:~# log list | grep logging
legato_logging
/legato_logging_exe @ EMERGENCY
/legato_logging_exe @ EMERGENCY
root@swi-mdm9x28:~#

Here’s a sample that I tested with:

void timer_handler ( le_timer_Ref_t timerRef)
{
LE_DEBUG(“Logging level DEBUG”);
LE_INFO (“Logging level INFO”);
LE_WARN (“Logging level WARNING”);
LE_ERROR(“Logging level ERROR”);
LE_CRIT (“Logging level CRITICAL”);
LE_EMERG(“Logging level EMERGENCY”);
return;
}

Setting to DEBUG will print all logs from the timer handler, INFO will print INFO and below, WARNING will print WARNING and below and so on.

Hope it helps!