Closed jamess0160 closed 1 year ago
Hi, this is the ui5-typescript repository and the issue report template says:
** IMPORTANT **
This tracker is for issues caused by the tools maintained here (type definition generator and ts-interface generator for control development support).
But if the bug is within the original OpenUI5/SAPUI5 code/JSDoc, then please report the issue there!
Right now I don't see how this report would be about the type definition generators of UI5. Do I miss anything?
If it is about setting the logging level in UI5, then the OpenUI5 repository would be the place to report. Additional information would then be helpful, like how exactly you have tried to set the log level and what UI5 version you are using and whether it is a standalone app or there's something around like FLP, which could also affect logging.
But anyway, a page with the following setting doesn't give me any logging:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<title>OpenUI5 Logging App</title>
<script id="sap-ui-bootstrap" src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_fiori_3" data-sap-ui-libs="sap.m" data-sap-ui-compatVersion="edge">
</script>
<script>
sap.ui.require(["sap/base/Log"], (Log) => {
Log.setLevel(Log.Level.ERROR);
// create a simple button
var oButton = new sap.m.Button({
text: "Hello World",
press: function () {
// log a message when the button is pressed
console.log("Hello world button was pressed");
}
}).placeAt("content");
})
</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
But changing the log level to TRACE gives a couple of lines of logging on startup. Please check whether this also works for you before opening that other ticket.
First, thanks for the help!
I forgot to mention that this is a problem that only occurred to me in TS projects, when I generate a JS project through the yeoman generator it has the normal log level and I believe I can change the level there, but I haven't tested it.
This is the script tag I'm currently using:
<script id="sap-ui-bootstrap" src="resources/sap-ui-core.js" data-sap-ui-resourceroots='{ "bti_framework": "./" }' data-sap-ui-theme="sap_horizon" data-sap-ui-oninit="module:sap/ui/core/ComponentSupport" data-sap-ui-async="true" data-sap-ui-compatVersion="edge" data-sap-ui-frameOptions="trusted" data-sap-ui-xx-waitForTheme="true" data-sap-ui-xx-supportedLanguages="en,de"></script>
I tested the script tag you sent and with just a few changes it worked, no more console logs. I dug a little deeper and noticed that what caused the logs to come out was the fact that your tag had the src at "https://openui5.hana.ondemand.com/resources/sap-ui-core.js" while mine has "resources/sap-ui-core.js", I believe the log problem is in that library. Unfortunately I can't just migrate to the CDN as I prefer the theme of the old version of sap horizon.
I added the log level change right below the script tag and it worked in parts, it's already better than before.
To look for a complete solution for this would I open an issue in the repository that is linked to npm in this case?
And again thanks for the help
Ah! Loading UI5 from "resources/sap-ui-core.js" means the UI5 tooling is providing it. I'm not exactly sure about the log-related mechanisms there, but anyway: when I check in the debugger who sets the log level debug, then it happens here: https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/core/_ConfigurationProvider.js#L169
Adding data-sap-ui-logLevel="ERROR"
to the bootstrap script should solve the issue.
Oh, and the difference is because you are running more or less against the debug sources of UI5 when using "resources/..." and against the optimized sources when using the CDN. once you have done a UI5 build, you should also locally get the optimized ones (but now we are getting too far away from the TypeScript stuff supposedly discussed here. ;-)).
It worked! Thanks a lot for the help, I finally have just the errors in the console.
Describe the bug This is a minor thing, but is driving me nuts. The logs on the browser console is, apparently, default on verbose and all the things i did didn't do anything.
Expected behavior Should be able to change the log level
Additional context I already tried changing the log level on component.ts, on the CLI and directly on the browser, but not seems to work. Please, forgive me if i am doing something wrong, english is not my first language