XForms logging
Enabling XForms logging
Sometimes, an error message or stack trace in the Orbeon Forms log file provides enough information to a developer to figure out what went wrong, but not always. In such cases, you can turn to the XForms engine logging facility. To enable it, make sure you uncomment the following logging <Logger> (Log4j 2.x) or <Category> (Log4j 1.x):
Log4j 2.x (WEB-INF/resources/config/log4j2.xml):
<Logger name="org.orbeon.oxf.xforms.processor.XFormsServer" level="debug"/>Log4j 1.x (WEB-INF/resources/config/log4j.xml):
<category name="org.orbeon.oxf.xforms.processor.XFormsServer">
<priority value="debug"/>
</category>Note: You must restart your Servlet container for those changes to be taken into account.
Fine-grained configuration
Two properties in WEB-INF/resources/config/properties-local.xml control exactly what is logged by the XForms engine:
<property as="xs:NMTOKENS" name="oxf.xforms.logging.debug">
document
model
submission
control
event
action
analysis
server
html
process
</property>
<property as="xs:NMTOKENS" name="oxf.xforms.logging.error">
submission-error-body
</property>oxf.xforms.logging.debug controls what is logged at debug level:
Related to a particular XForms document:
modelactivity related to
xf:model, including instance loads, validation, and binds
submissiontiming activity related to
xf:submission
submission-detailsdetail activity related to
xf:submissionrequires
submissionto be present as well
controlactivity related to controls
eventactivity related to events dispatching and propagation
actionactivity related to XForms actions
documentother activity related to an XForms document
this includes the output of the
<xf:message>action with levelxxf:log-debug
processactivity related to processes
Not related to a particular XForms document:
analysisactivity related to the static analysis of an XForms document
serveractivity related to handling Ajax requests
htmlactivity related to converting XForms to HTML
resourcesactivity related to handling XForms CSS and JavaScript resources
stateactivity related to state handling
resolveractivity related to the URI resolver
utilsmiscellaneous activity
cache[SINCE Orbeon Forms 4.6]
activity of the static state cache during XForms initialization
Data:
html-static-staterequires
htmloutputs the static state input
analysis-xbl-treerequires
analysisoutputs the detail of the XBL shadow trees computed
submission-bodyrequires
submissionANDsubmission-detailsoutputs the detail of submission request/response bodies
model-serialized-instancerequires
modeloutputs the full instances serialized into the dynamic state after an Ajax request completes
server-bodyrequires
serveroutputs the full Ajax request and response bodies
oxf.xforms.logging.error controls what is logged at error level:
submission-error-bodyWhether to attempt to output a submission response body when a submission error occurs
This is enabled by default, but you can turn it off, e.g. for data sensitivity reasons
Binary bodies are not logged, but the logger mentions that the type is a binary type
When the response body is NOT logged and is used for
replace="instance|all", streaming is taking place. However when the response body IS logged, streaming does not take place:The body is read in memory
The body is logged
Then the rest of the submission proceeds
server-bodyoutput the Ajax request in case of error occurring while processing the request
Development configuration
During XForms development, you might want to enable a more aggressive debug configuration.
Change your Log4j2 or Log4j configuration. In your
WEB-INF/resources/config, check if you have a file namedlog4j2.xmlorlog4j.xml:If you have a file named
log4j2.xml(with2in the file name), inside the element<Loggers>, add:If you have a file named
log4j.xml(without2in the file name), uncomment the following:
Configure the
oxf.xforms.logging.debugproperty in yourconfig/properties-local.xml. You can choose precisely what the XForms engine logs. The following is the most comprehensive configuration. It will log almost everything. In most cases, this is a good configuration during development, and while troubleshooting issues in staging:
Production configuration
No debug output
In production, you probably don't want any debug information coming out to your logs. So set this in log4j.xml:
Alternatively, remove or comment-out the lines above. When this is done, the oxf.xforms.logging.debug property is no longer used, so it does not matter what it contains. However, the oxf.xforms.logging.error is still relevant. Configure it appropriately, depending on whether you want to see submission responses bodies logged or not.
Just submission timings
If you only want to see submission timings, in your log4j.xml use:
And in your properties-local.xml:
Example output
The following shows a sample XForms logging session:
See also
Last updated