You can enable application logging in your applications manifest file so that your application will write all its logging messages to that file. The debug.log file will still be used for writing log entries from the runtime executables. You can set this up in your manifest file as follows:
"startup_app": {
"enableAppLogging": true
}
You can also set the lowest level of severity of messages that you would like to have stored in the debug.log messages from within the code. For example you are setting the log level to the "WARNING" level as follows:
fin.System.setMinLogLevel(
LEVEL,
() => console.log("success"),
(errString, err) => console.log(errString, err)
);
Writing messages with fin.System.log()
You can use OpenFin's own log method to write entries to the debug.log only. The entries in the debug.log are affected by the minimum log level you have previously set. If you use the following code to create the following logs:
fin.System.log("info", "fin info message");
fin.System.log("warning", "fin warning message");
fin.System.log("error", "fin error message");
your debug.log file will get the following entries:
[4924:0803/210343.088:WARNING:electron_api_app.cc(1836)] fin warning message
[4924:0803/210343.089:ERROR:electron_api_app.cc(1838)] fin error message
your app.log will not get any of these messages
Writing message with console API
Writing messages with console using its logging method directly will send the messages to both the debug.log and the app.log file. If you were to use for following code while you have application logging enabled:
console.debug("console DEBUG message")
console.info("console INFO message")
console.warn("console WARNING message")
console.error("console ERROR message")
none of these will appear in the debug.log but you will see the following lines in the app.log:
2022-08-04 01:14:59.624 DEBUG - console DEBUG message
2022-08-04 01:14:59.624 INFO - console INFO message
2022-08-04 01:14:59.633 WARN - console WARNING message
2022-08-04 01:14:59.633 ERROR - console ERROR message
It is intentional that there is no level filtering on the app.log file as these are intended for log developers.
Related Information:
Comments
0 comments
Please sign in to leave a comment.