Search code examples
marklogicmarklogic-corb

How to set up CORB log to debug XQUery information


I am using CORB to run module on MarkLogic DB via command:

ml local corb --modules=abcd.xqy

And want to generate log on this processing for which I have added xdmp:log() into abcd.xqy. But, I am unable to find out where is generated log message. It is not on command prompt and not in MarkLgoic log directory.

Is there any way to setup CORB log setting through properties file? If yes, how? or any other way to track generated log message.

Some background of the follow is:

  1. I have ingested RDFXML through roxy command

    ml local deploy content

  2. Now, I am taking RDFXML as input and converting them into triples through above mentioned CORB command. It is running successfully.
  3. insert-taxonomy-triples.xqy has some log messages which are not displaying on command prompt as well as MarkLogic log directory.
My complete command is:

ml local corb --modules=/tools/ingest/insert-taxonomy-triples.xqy --uris=/tools/ingest/find-taxonomy-uris.xqy

insert-taxonomy-triples.xqy

import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy"; import module namespace c = "http://bsigroup.com/ns/meddev/common/constants" at "/app/common/constants.xqy";

declare namespace xdmp = "http://marklogic.com/xdmp";

declare variable $URI as xs:string external;

let $taxonomy-name := fn:replace(fn:replace($URI, '/taxonomies/',''), '.rdf','')

let $graph-name := fn:concat($c:BSI-TAXONOMY-BASE-URI, $taxonomy-name)

let $log := xdmp:log("xxxxxxxxxxxxxxxx")

let $log := xdmp:log(fn:concat("/tools/ingest/insert-taxonomy-triples.xqy ", "main module: parsing taxonomy ", $URI, " and inserting triples to graph ", $graph-name), "debug")

let $permissions := (xdmp:permission("meddev-role", "update"), xdmp:permission("meddev-role", "read"))

return sem:rdf-insert( sem:rdf-parse(fn:doc($URI), "rdfxml"), (fn:concat("override-graph=", $graph-name)), $permissions, ($graph-name) )

find-taxonomy-uris.xqy

declare namespace xdmp = "http://marklogic.com/xdmp"; declare namespace cts = "http://marklogic.com/cts";

let $taxonomy-uris := cts:uri-match("/taxonomies/*")

let $log := xdmp:log(fn:concat('/tools/ingest/find-taxonomy-uris.xqy', 'main module: the taxonomies found are ', fn:count($taxonomy-uris), ' URIs ' ), 'debug')

return ( fn:count($taxonomy-uris), $taxonomy-uris )

Command prompt result:

D:\mdol-dev\mdol-as>ml local corb --modules=/tools/ingest/insert-taxonomy-triple s.xqy --uris=/tools/ingest/find-taxonomy-uris.xqy

java -cp D:/mdol-dev/mdol-as/deploy/lib/java/corb.jar;D:/mdol-dev/mdol-as/deploy /lib/java/marklogic-xcc-5.0.2.jar com.marklogic.developer.corb.Manager xcc://adm in:admin@localhost:9002/meddev-content "" tools/ingest/insert-taxonomy-triples.x qy 1 tools/ingest/find-taxonomy-uris.xqy "/" meddev-modules false

logging to CONSOLE Jul 16, 2014 10:35:59 AM com.marklogic.developer.SimpleLogger configureLogger

INFO: setting up logging for: com.marklogic.ps Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager run

INFO: com.marklogic.developer.corb.Manager starting: version 2010-08-24.1 on 1.7 .0_40 (Java(TM) SE Runtime Environment) Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager run

INFO: maximum heap size = 1783 MiB Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager prepareContentSour ce

INFO: using content source xcc://admin:admin@localhost:9002/meddev-content Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager registerStatusInfo

INFO: Configured modules db: meddev-modules Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager registerStatusInfo

INFO: Configured modules root: / Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager registerStatusInfo

INFO: Configured uri module: tools/ingest/find-taxonomy-uris.xqy Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager registerStatusInfo

INFO: Configured process module: tools/ingest/insert-taxonomy-triples.xqy Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager prepareModules

INFO: checking modules, database: meddev-modules Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager prepareModules

INFO: Skipping module installation: tools/ingest/find-taxonomy-uris.xqy Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager prepareModules

INFO: Skipping module installation: tools/ingest/insert-taxonomy-triples.xqy Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager populateQueue

INFO: populating queue Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager populateQueue

INFO: invoking module /tools/ingest/find-taxonomy-uris.xqy Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager populateQueue

INFO: expecting total 2 Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Manager populateQueue

INFO: queued 2/2 Jul 16, 2014 10:35:59 AM com.marklogic.developer.corb.Monitor monitorResults

INFO: monitoring 2 tasks Jul 16, 2014 10:39:29 AM com.marklogic.developer.corb.Monitor showProgress

INFO: completed 1/2, 0 tps, 1 active threads Jul 16, 2014 10:39:29 AM com.marklogic.developer.corb.Monitor monitorResults

INFO: waiting for pool to terminate Jul 16, 2014 10:39:29 AM com.marklogic.developer.corb.Monitor monitorResults

INFO: completed all tasks 2/2, 0 tps, 0 active threads


Solution

  • Any messages generated by xdmp:log() will be in ErrorLog.txt (on Linux: /var/opt/MarkLogic/Logs/ErrorLog.txt). The command as you have it written is also using the Roxy Deployer.

    The --modules parameter tells Corb what you want to do, but you also need to specify either --collection (a string naming a collection to process) or --uris (a module that will identify which documents to process). Add one of those to your command, and you should see Corb's logging messages appear on the console.


    Based on the additional information, I see a couple of things.

    1. find-taxonomy-uris.xqy apparently found two: INFO: queued 2/2.
    2. insert-taxonomy-triples.xqy processed those two successfully: INFO: completed all tasks 2/2.
    3. You have three xdmp:log() calls, two of which pass in the "debug" parameter. The default setting for file log level is info, which would exclude the debug messages. In the Admin UI, go to Groups -> Default (assuming that's the group name you're using), scroll down to "file log level" and set it to "debug". That should make those messages appear. You should already be seeing the xdmp:log("xxxxxxxxxxxxxxxx") call; are you?

    Another observation: since your goal is to transform RDFXML to MarkLogic triples, you could use mlcp, which performs that transformation for you out of the box. If you tried that and it didn't work, that would be useful to know.