cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HANA XSA: Log level is not changed

peterboertien
Discoverer
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

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.

peterboertien
Discoverer
0 Kudos

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

Answers (0)