diff --git a/vehicle/OVMS.V3/components/mongoose/src/mg_locals.h b/vehicle/OVMS.V3/components/mongoose/src/mg_locals.h
index 5d22a03..7573f66 100644
--- a/vehicle/OVMS.V3/components/mongoose/src/mg_locals.h
+++ b/vehicle/OVMS.V3/components/mongoose/src/mg_locals.h
@@ -35,6 +35,13 @@
 
 #define ESP_PLATFORM 1
 #define MG_ENABLE_HTTP 1
+#define MG_ENABLE_DEBUG 1
+#define MG_LOG_ESP 1
+
+#if MG_LOG_ESP
+#include "ovms_log.h"
+#endif
+
 
 #ifdef CONFIG_MG_ENABLE_FILESYSTEM
 #define MG_ENABLE_FILESYSTEM 1
diff --git a/vehicle/OVMS.V3/components/mongoose/src/mongoose.c b/vehicle/OVMS.V3/components/mongoose/src/mongoose.c
index c9b4f06..0319245 100644
--- a/vehicle/OVMS.V3/components/mongoose/src/mongoose.c
+++ b/vehicle/OVMS.V3/components/mongoose/src/mongoose.c
@@ -605,9 +605,18 @@ void cs_log_set_filter(const char *pattern) {
   }
 }
 
+#if MG_LOG_ESP
+static const char* TAG = "mongoose";
+static char cs_log_cur_msg_line[200];
+#endif
+
 int cs_log_print_prefix(enum cs_log_level, const char *, const char *) WEAK;
 int cs_log_print_prefix(enum cs_log_level level, const char *func,
                         const char *filename) {
+#if MG_LOG_ESP
+  cs_log_cur_msg_level = level;
+  sprintf(cs_log_cur_msg_line, "%-20.20s ", func);
+#else
   char prefix[21];
 
   if (level > cs_log_threshold) return 0;
@@ -629,17 +638,33 @@ int cs_log_print_prefix(enum cs_log_level level, const char *func,
     cs_log_ts = now;
   }
 #endif
+#endif //MG_LOG_ESP
   return 1;
 }
 
 void cs_log_printf(const char *fmt, ...) WEAK;
 void cs_log_printf(const char *fmt, ...) {
+#if MG_LOG_ESP
+  va_list ap;
+  va_start(ap, fmt);
+  vsnprintf(cs_log_cur_msg_line+21, sizeof(cs_log_cur_msg_line)-22, fmt, ap);
+  switch(cs_log_cur_msg_level) {
+    case LL_ERROR:          ESP_LOGE(TAG, "%s", cs_log_cur_msg_line); break;
+    case LL_WARN:           ESP_LOGW(TAG, "%s", cs_log_cur_msg_line); break;
+    case LL_INFO:           ESP_LOGI(TAG, "%s", cs_log_cur_msg_line); break;
+    case LL_DEBUG:          ESP_LOGD(TAG, "%s", cs_log_cur_msg_line); break;
+    case LL_VERBOSE_DEBUG:  ESP_LOGV(TAG, "%s", cs_log_cur_msg_line); break;
+    default: break;
+  }
+  va_end(ap);
+#else
   va_list ap;
   va_start(ap, fmt);
   vfprintf(cs_log_file, fmt, ap);
   va_end(ap);
   fputc('\n', cs_log_file);
   fflush(cs_log_file);
+#endif // MG_LOG_ESP
   cs_log_cur_msg_level = LL_NONE;
 }
 
@@ -3500,6 +3525,7 @@ int mg_socket_if_create_conn(struct mg_connection *nc) {
 }
 
 void mg_socket_if_destroy_conn(struct mg_connection *nc) {
+  DBG(("nc=%p sock=%d flags=%lx", nc, nc->sock, nc->flags));
   if (nc->sock == INVALID_SOCKET) return;
   if (!(nc->flags & MG_F_UDP)) {
     closesocket(nc->sock);
diff --git a/vehicle/OVMS.V3/components/ovms_webserver/src/ovms_webserver.cpp b/vehicle/OVMS.V3/components/ovms_webserver/src/ovms_webserver.cpp
index 133c8f1..3dfebf8 100644
--- a/vehicle/OVMS.V3/components/ovms_webserver/src/ovms_webserver.cpp
+++ b/vehicle/OVMS.V3/components/ovms_webserver/src/ovms_webserver.cpp
@@ -291,6 +291,7 @@ PageEntry* OvmsWebServer::FindPage(const char* uri)
 void OvmsWebServer::EventHandler(struct mg_connection *nc, int ev, void *p)
 {
   PageContext_t c;
+  if (ev != MG_EV_POLL) ESP_LOGD(TAG, "EventHandler: conn=%p ev=%d p=%p", nc, ev, p);
   
   switch (ev)
   {
