Page 1 of 1

View Esp Log With Arduino IDE

Posted: Tue May 15, 2018 5:52 pm
by macirtr
Hello;

I am developing bluetooth application with arduino ide and esp32 ble development board in windows 7.

How how can i view esp log data?

Thanks.

Example
ESP_LOGD(LOG_TAG, "Ignoring %s, already seen it.", advertisedAddress.toString().c_str());

Re: View Esp Log With Arduino IDE

Posted: Wed May 16, 2018 8:52 am
by chegewara

Re: View Esp Log With Arduino IDE

Posted: Sat Nov 24, 2018 8:06 am
by felix41382
Thanks for the advice. I changed the settings in the Arduino under Tools --> Core Debug Level to Verbose, but still no debug ouput.

Do you have any other idea?

Code: Select all

#include "esp32-hal-log.h"

void setup() {
  Serial.begin(115200);
  Serial.println("Starting"); // will be shown in the terminal
  Serial.setDebugOutput(true);

  esp_log_level_set("*", ESP_LOG_VERBOSE);
  ESP_LOGD("EXAMPLE", "This doesn't show");

  log_v("Verbose");
  log_d("Debug");
  log_i("Info");
  log_w("Warning"); 
  log_e("Error");
}

void loop() {
  // nothing to do
}

Re: View Esp Log With Arduino IDE

Posted: Sun Nov 25, 2018 3:40 pm
by JoaoLopesF
Hi,
If you not can it works, have a library for arduino that have debug levels and more:
https://github.com/JoaoLopesF/SerialDebug

Re: View Esp Log With Arduino IDE

Posted: Thu Jan 21, 2021 6:23 pm
by cakira
Most of the time I use platform IO, but as my colleagues use the Arduino IDE, I had the same problem described here.

My solution was to include in the very begining of the .ino file, before the includes:

Code: Select all

#ifdef CORE_DEBUG_LEVEL
#undef CORE_DEBUG_LEVEL
#endif

#define CORE_DEBUG_LEVEL 3
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
I'm not sure the last define is necessary, but anyway,

Code: Select all

ESP_LOGI(TAG, "Read: %s", message);
is working and printing: [­I][EspFile.ino:240] loop(): Read: 23;33.19;-5;-119;32.25;36, as I intended.

Re: View Esp Log With Arduino IDE

Posted: Fri Mar 17, 2023 10:03 pm
by sigmdel
cakira wrote:
Thu Jan 21, 2021 6:23 pm
Most of the time I use platform IO, but as my colleagues use the Arduino IDE, I had the same problem described here.

My solution was to include in the very begining of the .ino file, before the includes:

Code: Select all

#ifdef CORE_DEBUG_LEVEL
#undef CORE_DEBUG_LEVEL
#endif

#define CORE_DEBUG_LEVEL 3
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
I'm not sure the last define is necessary, but anyway,

Code: Select all

ESP_LOGI(TAG, "Read: %s", message);
is working and printing: [­I][EspFile.ino:240] loop(): Read: 23;33.19;-5;-119;32.25;36, as I intended.

Thank you cakira. Can confirm that the last define is needed. Might also want to undef LOG_LOCAL_LEVEL to avoid compiler warnings. Here is how I set the log level to debug (4).

Code: Select all

#if (!PLATFORMIO)
  // Enable Arduino-ESP32 logging in Arduino IDE
  #ifdef CORE_DEBUG_LEVEL
    #undef CORE_DEBUG_LEVEL
  #endif
  #ifdef LOG_LOCAL_LEVEL
    #undef LOG_LOCAL_LEVEL
  #endif

  #define CORE_DEBUG_LEVEL 4
  #define LOG_LOCAL_LEVEL CORE_DEBUG_LEVEL
#endif  

#include <esp32-hal-log.h>
... 
void setup()
{
    Serial.begin(115200);
    delay(10000);
    Serial.printf("LOG_LOCAL_LEVEL %d\n", LOG_LOCAL_LEVEL);
    //                                   esp32-hal-log.h            esp_log.h
    //                       level 0 = ARDUHAL_LOG_LEVEL_NONE    = ESP_LOG_NONE 
    ESP_LOGE(TAG, "ESP_LOGE, level 1 = ARDUHAL_LOG_LEVEL_ERROR   = ESP_LOG_ERROR");
    ESP_LOGW(TAG, "ESP_LOGW, level 2 = ARDUHAL_LOG_LEVEL_WARN    = ESP_LOG_WARN");    
    ESP_LOGI(TAG, "ESP_LOGI, level 3 = ARDUHAL_LOG_LEVEL_INFO    = ESP_LOG_INFO");
    ESP_LOGD(TAG, "ESP_LOGD, level 4 = ARDUHAL_LOG_LEVEL_DEBUG   = ESP_LOG_DEBUG");
    ESP_LOGV(TAG, "ESP_LOGV, level 5 = ARDUHAL_LOG_LEVEL_VERBOSE = ESP_LOG_VERBOSE");    
   ... 
The last ESP_LOGV(...) is not printed because verbose (5) > debug (4). These settings are local only and #define CORE_DEBUB_LEVEL 4 has no effect on the debug level of the core. As felix41382/Neil Kolban pointed out, the output of log messages from the core is determined by the Core debug level set in with Tools in the IDE.

If anyone is wondering, doing the same in PlatformIO requires adding an env build flag in the platformio.ini:

Code: Select all

[env:seeed_xiao_esp32c3]
board = seeed_xiao_esp32c3
framework = arduino
; Enable ArduinoESP32 logging
build_flags = -DCORE_DEBUG_LEVEL=4  ; Clean project after changing the level
... 
However that sets the log level for both the core and the current project.