# HG changeset patch # User Kim Alvefur # Date 1431346583 -7200 # Node ID 160c35d2a5a2ad8231a055cf7389e07895221101 # Parent d85d5b0bf9773f1c7f67d168a12f375cdf9d8403 mod_storage_xmlarchive: Improve logging of parse errors diff -r d85d5b0bf977 -r 160c35d2a5a2 mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Thu May 07 23:39:54 2015 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 11 14:16:23 2015 +0200 @@ -100,6 +100,7 @@ return function () if limit and count >= limit then xmlfile:close() return; end + local filename; for d = start_day, last_day, step do if d ~= start_day or not items then @@ -112,7 +113,8 @@ first_item, last_item = #items, 1; end local ferr; - xmlfile, ferr = io.open(dm.getpath(username .. "@" .. dates[d], module.host, self.store, "xml")); + filename = dm.getpath(username .. "@" .. dates[d], module.host, self.store, "xml"); + xmlfile, ferr = io.open(filename); if not xmlfile then module:log("error", "Error: %s", ferr); return; @@ -137,7 +139,7 @@ local data = xmlfile:read(item.length); local ok, err = stream:feed(data); if not ok then - module:log("warn", "Parse error: %s", err); + module:log("warn", "Parse error in %s at %d+%d: %s", filename, item.offset, item.length, err); end if result then local stanza = result;