marklogic-community / marklogicworkflow

Content and Human Centric Workflow for MarkLogic NoSQL systems
Other
19 stars 12 forks source link

Use trace logging instead of xdmp:log #89

Open adamfowleruk opened 8 years ago

adamfowleruk commented 8 years ago

To support multiple log levels

adamfowleruk commented 8 years ago

curl -X PUT --anyauth --user admin:admin --header "Content-Type:application/json" -d'{"group-name":"Default","events-activated":true,"event":["marklogicworkflow.actions","marklogicworkflow.alerts"]}' http://localhost:8002/manage/v2/groups/Default/properties

jpkrebs commented 8 years ago

What do you think about doing something along the lines of what's below? Unfortunately it doesn't look like you can set the log levels using the REST API but it's easily done in the admin console.

declare variable $DEBUG-LEVELS := ("finest","finer","fine","debug"); declare variable $DEBUG := xdmp:log-level() = $DEBUG-LEVELS; ... let $_ := if ($DEBUG) then xdmp:trace("marklogicworkflow.actions", "Running Action 1") else ()

eouthwaite commented 5 years ago
  1. prefix all trace events with the name of your app (which presumably is or can be shortened to an acronym). Just helps make it obvious that you own them and they’re specific to your app.

  2. define all of your trace events as constants in an sjs/xqy library.

  3. documentation: can always set trace events via the command line so you don’t have to click click click around the Admin UI:

    gradle –Pevents=abc-event1,abc-event2,some-other-event,etc mlSetTraceEvents