MJBZA
MJBZA

Reputation: 5018

How to prevent SAPUI5 from log output in console?

I developed a Fiori application with SAPUI5 inside of the WEBIde. When I open console of the browser I see some log inside of the console that are generated automatically with SAPUI5.

enter image description here

How can I prevent SAPUI5 from generating unwanted logs?

Upvotes: 1

Views: 2928

Answers (2)

Boghyon Hoffmann
Boghyon Hoffmann

Reputation: 18064

This was identified as a bug (OpenUI5 issue #2692) which got fixed with the release of UI5 version 1.72.0. The only UI5 produced log left from the console is "Device API logging initialized" from the sap/ui/Devicesrc which cannot be controlled by sap/base/Log yet.

Since we cannot use the logging from jquery.sap.global.js, we need to come up with a separate solution for the device API.

Other issue messages are from the browser, one of which can be resolved by removing sync XHRs from the application.

Since UI5 1.72 and with asynchronous loading, the console is much cleaner now:

UI5 console log since 1.72.0
From: https://run.plnkr.co/plunks/16J1TFICxbqETCzaxuZ0/?sap-ui-xx-componentPreload=off

Upvotes: 1

Peter Roehlen
Peter Roehlen

Reputation: 128

You could try jQuery.sap.log.setLevel in your Component initialization. Valid parameter values include:

However, I'm not sure if any of the messages in your screen shot get generated prior to the component being initialized.

Edit: If your app isn't launched from Fiori Launchpad, you could try setting the log level in your bootstrap code - i.e. in sap.ui.getCore().attachInit().

Upvotes: 0

Related Questions