Skip to Content

SAP HANA XSA: Log level is not changed

Hi all,

I'm trying to use the @sap/logging module within XSA to log some information during some actions in the JS module. I followed the documentation I found regarding this subject ( Set up Logging ).

In the server.js file the initialization is done for the module:

const logging = require("@sap/logging");

//Create logging
app.use(logging.expressMiddleware(logging.createAppContext())); 

Next step is to add the logging in the specific file:

//Test logging for error message
req.loggingContext.getLogger('/Application').error("Test error message");
		
//Test logging for info message
req.loggingContext.getLogger('/Application').info("Test info message");

In the debugger (and documentation) I see that the default level is set to Error. This is the case, because only the error message is logged.

Next step is to change the log level. In the documentation that I found ( Trouble shooting XSA JS Applications) the level can be changed in the command line with the following command:

xs set-logging-level <application-name> '*' info

I changed the log level for the application (restart not necessary) to info (and also checked it with the command "list-logging-levels"), but when I run the JS module, the info message is nog logged. When I check in the debugger, the log level is still on error.

Does anybody has an idea what I'm doing wrong?

Thanks in advance,

Peter Boertien

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 15, 2018 at 12:59 PM

    When you say you are changing the log level and then checking in the debugger - are you running these from the Web IDE? I've found that because the Web IDE uses a delta change injection mechanism and a kind of wrapper service, that the logging changes doesn't take effect via set-logging-level. That works fine if this is regularly deployed app but not if its running from the Web IDE.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Thomas,

      thanks for your response. I did some tests and saw that it was working on the other environments in the landscape (where the application was deployed). Do I understand it correctly that to the change the level on development (WebIDE), i have to use the <XS_APP_LOG_LEVEL> environment variable?

      Regards,

      Peter