- yaz_log(LOG_LOG, "ODR error on incoming PDU: %s [near byte %d] ",
- odr_errmsg(odr_geterror(m_odr_in)),
- odr_offset(m_odr_in));
- yaz_log(LOG_LOG, "PDU dump:");
+ const char *element = odr_getelement(m_p->odr_in);
+ yaz_log(YLOG_LOG, "PDU decode failed '%s' near byte %ld. Element %s",
+ odr_errmsg(odr_geterror(m_p->odr_in)),
+ (long) odr_offset(m_p->odr_in),
+ element && *element ? element : "unknown");
+ yaz_log(YLOG_LOG, "Buffer length: %d", (int) len);
+ if (len > 0)
+ {
+ WRBUF w = wrbuf_alloc();
+ wrbuf_write_escaped(w, buf, len > 1024 ? 1024 : len);
+ yaz_log(YLOG_LOG, "Buffer bytes: %s", wrbuf_cstr(w));
+ wrbuf_destroy(w);
+ }
+ yaz_log(YLOG_LOG, "PDU dump:");