Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Use trace logging instead of xdmp:log #89

Open
adamfowleruk opened this issue Oct 15, 2015 · 3 comments
Open

Use trace logging instead of xdmp:log #89

adamfowleruk opened this issue Oct 15, 2015 · 3 comments
Milestone

Comments

@adamfowleruk
Copy link
Contributor

To support multiple log levels

@adamfowleruk adamfowleruk added this to the Sprint-004 milestone Oct 15, 2015
@adamfowleruk
Copy link
Contributor Author

  • xdmp:log is ok, but trace() gives u a trace event that you can easily enable/disable (which you can always mask with a wrapper eg debug:log)

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 jpkrebs self-assigned this Apr 21, 2016
@jpkrebs
Copy link
Collaborator

jpkrebs commented Apr 21, 2016

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
Copy link
Contributor

  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
    

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants