Page 1 of 1

Weirdness with logging.

Posted: Tue May 01, 2018 5:04 pm
by fly135
This is my sdkconfig for logging....

Code: Select all

#
# Log output
#
CONFIG_LOG_DEFAULT_LEVEL_NONE=
CONFIG_LOG_DEFAULT_LEVEL_ERROR=
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
CONFIG_LOG_DEFAULT_LEVEL_INFO=
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=
CONFIG_LOG_DEFAULT_LEVEL=2
CONFIG_LOG_COLORS=y
But I'm seeing this after boot in my log....

Code: Select all

I (233) wifi: wifi firmware version: ebd3e5d
I (233) wifi: config NVS flash: enabled
I (233) wifi: config nano formating: disabled
I (263) wifi: Init dynamic tx buffer num: 32
I (263) wifi: Init data frame dynamic rx buffer num: 32
I (263) wifi: Init management frame dynamic rx buffer num: 32
I (263) wifi: Init static tx buffer num: 16
I (263) wifi: wifi driver task: 3ffd59ac, prio:23, stack:4096
I (273) wifi: Init static rx buffer num: 10
I (273) wifi: Init dynamic rx buffer num: 32
I (283) wifi: wifi power manager task: 0x3ffd5b20 prio: 21 stack: 2560
There is also code in my app that is printing with "ESP_LOGD" and they are coming out on the terminal as well.

If I put the following in my code then those prints are suppressed.

esp_log_level_set("*", ESP_LOG_NONE);

The logical explanation is that someone else's code is calling esp_log_level_set with different parameters, but I haven't nailed that down yet. Just wondering if logging works as expected for everyone else. I get used to seeing those log messages and it's only that I'm trying to eliminate then that I noticed this issue.

John A

Re: Weirdness with logging.

Posted: Tue May 01, 2018 5:10 pm
by fly135
Here's more info. If I put "esp_log_level_set("*", ESP_LOG_NONE)" as the very first instruction in app_main it works. That means nothing after it can be changing the logging level. It's like something in the SDK is upping the log level before app_main is called.

John A

Re: Weirdness with logging.

Posted: Tue May 01, 2018 5:50 pm
by kolban
Is it possible that after changing your log level in sdkconfig that you didn't recompile the source files that are emitting those messages?

Re: Weirdness with logging.

Posted: Tue May 01, 2018 5:56 pm
by fly135
Oh I get it. The defines are in the app source and unless I do a make clean they don't get updated. But the statement I put in app_main overrides those defines. Totally makes sense. Thanks Kolban!

John A

Re: Weirdness with logging.

Posted: Tue May 01, 2018 6:17 pm
by fly135
That wasn't the answer. I did a make clean and i'm still getting ESP_LOGD logs from code in my app, plus ESP_LOGI from the wifi that isn't in my app. sdkconfig is...

Code: Select all

#
# Log output
#
CONFIG_LOG_DEFAULT_LEVEL_NONE=
CONFIG_LOG_DEFAULT_LEVEL_ERROR=
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
CONFIG_LOG_DEFAULT_LEVEL_INFO=
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=
CONFIG_LOG_DEFAULT_LEVEL=2
CONFIG_LOG_COLORS=y

Re: Weirdness with logging.

Posted: Tue May 01, 2018 10:31 pm
by papaluna
The ESP-IDF Wifi component used to set its own log level. I don't know if that is still the case in the current master branch.

I still do this in my projects:
````
// Production: dump less messages
esp_log_level_set("wifi", ESP_LOG_WARN);
esp_log_level_set("tcpip_adapter", ESP_LOG_WARN);
````

Re: Weirdness with logging.

Posted: Tue May 01, 2018 10:47 pm
by fly135
I'm kind of thinking it might have something to do with my version of the SDK. I'm waiting for the next official release before changing.

John A

Re: Weirdness with logging.

Posted: Wed May 02, 2018 4:58 am
by ESP_Angus
Hi fly135,

Paul is correct. Because the wifi libraries are precompiled they don't follow the same compile-time configuration as the logging levels set everywhere else.

If you add the first line he mentions to your app_main() ( esp_log_level_set("wifi", ESP_LOG_WARN); ), then you can set the log level for WiFi.

I see there isn't a note about this in the documentation. Will fix.


Angus

Re: Weirdness with logging.

Posted: Thu May 03, 2018 2:22 am
by ESP_Angus
Instead of documenting the problem we've fixed the inconsistency so that the sdkconfig log level is applied correctly to the WiFi libraries. This fix will be on the master branch shortly, for ESP-IDF v3.1.