ftos.logging.log
Starting with v24.3.0, this is renamed from log to ftos.logging.log.
Saves a log a message in the trace_roll.log file located in the root of the web application.
This is a method suitable for all business service components modules.
For detailed information about log management, such as logs anonymization or enabling logs based on conditions, see the Platform Administration Guide.
Syntax
function ftos.logging.log(message: string, {level: 'debug' | 'info' | 'warning' | 'error' | 'fatal'}): void
| Parameter | Type | Description |
|---|---|---|
message
|
string | Message to be logged. |
level optional |
'debug' | 'info' | 'warning' | 'error' | 'fatal' | Optional label for the severity level of the log message. |
Use log level warning when importing business log entries.
If the level is not specified, then the default is info. In logging systems, log levels follow a hierarchy. If the SDK is set to Information, it will only record messages at that level or higher (e.g., Warning, Error, Critical). Since Debug is a lower level, those messages will be ignored.
The hierarchy is Debug < Information < Warning < Error < Fatal
This hierarchy is important when working with the sdkLogLevel parameter in Configuration Manager. For example, if you set the sdkLogLevel to warning, then you need to specify the log level in the SDK method as warning or error in order to record such logs. If no level is specified when using the method, then it defaults to information which is lower than warning, and thus those logs won't be recorded.
Examples
In this example, we log the following message in the trace_roll.log file: Onboarding completed successfully. The message is logged with the info severity level.
ftos.logging.log('Onboarding completed successfully', {level: 'info'});
In this example, we use the ftos.logging.log method, together with two others, ftos.logging.setProperty and ftos.logging.clearProperty to log a warning message on performance.
function logPerformance(message) {
ftos.logging.setProperty("category", "performance");
ftos.logging.log(message, { level: "warning" });
ftos.logging.clearProperty("category");
}
logPerformance("performance related info");