View Esp Log With Arduino IDE

macirtr
Posts: 2
Joined: Tue May 15, 2018 5:45 pm

View Esp Log With Arduino IDE

Postby macirtr » Tue May 15, 2018 5:52 pm

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());


felix41382
Posts: 2
Joined: Sat Nov 24, 2018 8:01 am

Re: View Esp Log With Arduino IDE

Postby felix41382 » Sat Nov 24, 2018 8:06 am

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
}

JoaoLopesF
Posts: 59
Joined: Thu Aug 17, 2017 5:40 pm

Re: View Esp Log With Arduino IDE

Postby JoaoLopesF » Sun Nov 25, 2018 3:40 pm

Hi,
If you not can it works, have a library for arduino that have debug levels and more:
https://github.com/JoaoLopesF/SerialDebug

cakira
Posts: 1
Joined: Thu Jan 21, 2021 6:10 pm

Re: View Esp Log With Arduino IDE

Postby cakira » 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.

sigmdel
Posts: 2
Joined: Fri Mar 17, 2023 9:39 pm

Re: View Esp Log With Arduino IDE

Postby sigmdel » Fri Mar 17, 2023 10:03 pm

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.

Who is online

Users browsing this forum: No registered users and 64 guests