Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

XSJS Tracing - Trace files do not show trace levels other than 'error'

Hi!

I'm doing some experiments with server side javascript tracing on Hana. I created a small xsjs file that searches for some parameters on the web request (first name, last name and email) so I can call a DB procedure later. As I wanted to make sure that client data was arriving to the server properly, I added some trace calls using $.trace as you can see in the snipped below.

After some time I noticed that just $.trace.error calls were added to xsengine*trc trace files. In other words, information, debug and warnings were not being included on the trace files.

$.trace.info("INFO: Register_user.xsjs called");

$.trace.error("ERROR: Register_user.xsjs called");

if($.request.method === $.net.http.POST || $.request.method === $.net.http.GET) {

    var first_name = $.request.parameters.get("first_name");

    var last_name = $.request.parameters.get("last_name");

    var email = $.request.parameters.get("email");

   

    $.trace.error("ERROR: First Name:" + first_name);

    $.trace.error("ERROR: Last Name:" + last_name);

    $.trace.error("ERROR: Email:" + email);

   

    $.trace.warning("WARNING: First Name:" + first_name);

    $.trace.warning("WARNING: Last Name:" + last_name);

    $.trace.warning("WARNING: Email:" + email);

   

    // send response

    $.response.contentType = "application/json";

    $.response.status = $.net.http.OK;

   

    $.response.setBody(" { \"message\" : \"User registered successfully\"} ");

   

  } else {

    // unsupported method

  $.trace.error("ERROR: Method was not POST");

    $.response.status = $.net.http.INTERNAL_SERVER_ERROR;

  }

A small piece of a xsengine*.trc file is shown below.

[4940]{-1}[-1/-1] 2014-09-08 20:37:10.453384 e xsa: demo.user_c register_user.xsjs(00026) : ERROR: Register_user.xsjs called

[4940]{-1}[-1/-1] 2014-09-08 20:37:10.453690 e xsa: demo.user_c register_user.xsjs(00037) : ERROR: First Name:war

[4940]{-1}[-1/-1] 2014-09-08 20:37:10.453710 e xsa: demo.user_c register_user.xsjs(00038) : ERROR: Last Name:ning

[4940]{-1}[-1/-1] 2014-09-08 20:37:10.453796 e xsa: demo.user_c register_user.xsjs(00039) : ERROR: Email:warning@gmail.com

[4940]{-1}[-1/-1] 2014-09-08 20:58:21.854254 e xsa: demo.user_c register_user.xsjs(00024) : ERROR: request path: /demo/user_creation/logic/register_user.xsjs

[4940]{-1}[-1/-1] 2014-09-08 20:58:21.854285 e xsa: demo.user_c register_user.xsjs(00026) : ERROR: Register_user.xsjs called

Here are my doubts:

  • Is there any standard filter for trace calls (which for example would show just error messages as default)? If there is, where to change it?
  • Are there separate trace files for each trace level?
  • Looking at the beginning of each row on the trace file, are the numbers from the left side of the timestamp somehow relevant to determine what kind of trace leve is shown? What do they mean? (the sequence of [4635]{-1}[-1/-1] )

Related (and useful) links which couldn't solve the problem:

How to print from XSJS to Console

JSDoc: Namespace: trace

I'm using:

  • Cloudshare (SAP HANA SPS6 server)
  • Hana Studio Version: 1.80.3

Thanks for the support!

Tags:
Former Member replied
Not what you were looking for? View more on this topic or Ask a question