Difference between revisions of "ART Logging"

(Enabling ART Logging)
(Enabling ART Logging)
Line 18: Line 18:
 
import module namespace artlog = "http://art-decor.org/ns/artlog" at "../artlog/modules/artlog.xqm";
 
import module namespace artlog = "http://art-decor.org/ns/artlog" at "../artlog/modules/artlog.xqm";
  
let $log  := if ($artlog:logOn) then artlog:logRequest('lab') else ()
+
let $log  := if ($artlog:logOn) then artlog:logRequest('xis') else ()
 
return
 
return
 
     <ignore xmlns="http://exist.sourceforge.net/NS/exist">
 
     <ignore xmlns="http://exist.sourceforge.net/NS/exist">
Line 24: Line 24:
 
     </ignore>
 
     </ignore>
 
</nowiki>
 
</nowiki>
 +
If there already is a controller, but the existing code after the 'return' statement. Put the appname where it says 'xis'. This logs all requests to your app. Execute some application logic through the browser. Open ART Logging, if already open Refresh, and inspect.
 +
* SHOW shows the logged request in the Left hand pane.
 +
* GET/POST execute the request again, and show URL, status and response in the right hand pane.
 +
==POSTdata==
 +
POSTdata provides a special challenge. ART Logging cannot log it with request:get-data(), since this effectively eats the POSTdata, which is now empty on the request object. This means that the actual eXist code further downstream which should handle the POSTdata no longer works.
 +
 +
Somewehere in your code there will be a line like:
 +
'''let $data := request:get-data()/*'''
 +
Place
 +
'''let $log := if ($artlog:logOn) then artlog:logPostData($data, 'lab') else ()'''
 +
after this line to capture the POSTdata.

Revision as of 12:52, 26 November 2016

ART Logging

ART logging is a server side tool to capture traffic between Orbeon and eXist. It supports the following functions:

  • Turning logging on and off
  • Capture all requests made to eXist
  • Inspect those requests
  • Excute those requests server-side against eXist
  • Edit the requests with eXide, and execute the changed request.

Capturing browser-server traffic (F12) with Orbeon/eXist development is not always usefull. F12 typically captures calls between Orbeon client side code en Orbeon XForms server, and this does not relfect the actual XForms code written, making this hard to debug. Also it's often not obvious which calls are executed in XForms, especially when code uses stuff like event watchers and triggers. ART Logging allows the developer to trace and inspect all calls from Orbeon to eXist.

ART Logging can be found at: [server]:[8877]/apps/artlog/modules/logging.xquery

Enabling ART Logging

ART Logging is enabled in a package by inserting a controller.

xquery version "3.0";

import module namespace artlog = "http://art-decor.org/ns/artlog" at "../artlog/modules/artlog.xqm";

let $log  := if ($artlog:logOn) then artlog:logRequest('xis') else ()
return
    <ignore xmlns="http://exist.sourceforge.net/NS/exist">
        <cache-control cache="no"/>
    </ignore>

If there already is a controller, but the existing code after the 'return' statement. Put the appname where it says 'xis'. This logs all requests to your app. Execute some application logic through the browser. Open ART Logging, if already open Refresh, and inspect.

  • SHOW shows the logged request in the Left hand pane.
  • GET/POST execute the request again, and show URL, status and response in the right hand pane.

POSTdata

POSTdata provides a special challenge. ART Logging cannot log it with request:get-data(), since this effectively eats the POSTdata, which is now empty on the request object. This means that the actual eXist code further downstream which should handle the POSTdata no longer works.

Somewehere in your code there will be a line like:

let $data := request:get-data()/*

Place

let $log := if ($artlog:logOn) then artlog:logPostData($data, 'lab') else ()

after this line to capture the POSTdata.