summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-13 11:05:31 +0200
committerMichael Stahl <mstahl@redhat.com>2017-09-13 11:11:36 +0200
commit403c7729734ed1a545f0436e31c4d14a2724606d (patch)
treefa2fb7b50c228e08ffc01e906f9ed9de423887bc /sax
parent88c84e71e2559ec6d0b4f8c5101a149daa4a2b2b (diff)
sax: allow some debug logging in FastParser
Multi-threading makes this difficult; have it print synchronously where it is in the input when setting: SAL_LOG="+INFO.sax.fastparser+WARN" SAX_DISABLE_THREADS=1 Change-Id: I8c77974acb2b4d4e273fc9c0f273c345d8feb2ff
Diffstat (limited to 'sax')
-rw-r--r--sax/README3
-rw-r--r--sax/source/fastparser/fastparser.cxx6
2 files changed, 8 insertions, 1 deletions
diff --git a/sax/README b/sax/README
index 0e1e6175f3f1..00ca0f1af5ae 100644
--- a/sax/README
+++ b/sax/README
@@ -8,3 +8,6 @@ UNO services for SAX parsing and C++ functions for XMLSchema-2 data types.
+ C++ wrapper for fast SAX parser
+ C++ XMLSchema-2 data type conversion helpers
+Multi-threading in FastParser can be disabled for debugging purposes with:
+SAX_DISABLE_THREADS=1 SAL_LOG="+INFO.sax.fastparser+WARN"
+
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 8188724a91d9..a0cfc2f9e740 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -759,7 +759,8 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource)
rEntity.mxDocumentHandler->startDocument();
}
- rEntity.mbEnableThreads = (rEntity.maStructSource.aInputStream->available() > 10000);
+ rEntity.mbEnableThreads = rEntity.maStructSource.aInputStream->available() > 10000
+ && !getenv("SAX_DISABLE_THREADS");
if (rEntity.mbEnableThreads)
{
@@ -1199,7 +1200,10 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
if (rEntity.mbEnableThreads)
produce();
else
+ {
+ SAL_INFO("sax.fastparser", " startElement line " << mxDocumentLocator->getLineNumber() << " column " << mxDocumentLocator->getColumnNumber() << " " << prefix << ":" << localName);
rEntity.startElement( &rEvent );
+ }
}
catch (const Exception&)
{