BES - How to Debug the BES

From OPeNDAP Documentation
Revision as of 21:55, 11 December 2008 by Jimg (talk | contribs) (New page: == Tricks == * Set the beslistener to run in single, not multiprocess, mode. Do this in the ''bes.conf'' file * Build the bes using ''developer'' mode (so it won't need to be root, among ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1 Tricks

  • Set the beslistener to run in single, not multiprocess, mode. Do this in the bes.conf file
  • Build the bes using developer mode (so it won't need to be root, among other things). Do this with ./configure --enable-developer

2 Use the BESDEBUG Macro

Use the macro BESDEBUG defined in BESDebug.h.

Set the macro's 'context' as "bes" (nominally, or you can make up whatever you want) and then use the "cerr << "text: " << var << endl" style output except that you should leave off the initial "cerr <<" and start with the first argument of the stuff to be output - the marco will take care of getting the output sink and using the output operator.

3 Start beslistener with Debuging on

Use the -d option to beslistener and give -d one argument, a string, with two parts: "<output sink>,<context>". For example,

beslistener -d "cerr,bes" -c ../etc/bes/bes.conf

would start up beslistener with the bes context active and write all the debugging info to cerr. You can provide several contexts. The BES has debug statements for bes, ppt and server contexts although I think you can add new ones if you want by just using them in the macro.

4 Send Commands to the BES

The new BES on the xmlrequest branch uses XML instead of the old sql-style commands. Start bescmdln and type commands to it but not the xml header and the <request> element. Here's and example:

BESClient> <setContext name="dap_format">dap2</setContext>
BESClient> <setContainer name="c" space="catalog">/data/nc/fnoc1.nc</setContainer>
BESClient> <define name="d"> <container name="c" /> </define>
BESClient> <get type="das" definition="d" />
Attributes {
    u {
        String units "meter per second";
        String long_name "Vector wind eastward component";