Logger


Purpose

The Logger API allows changing the current logging level and enables access to the local log file. In consequence, it allows creating a web application that is able to retrieve log details and send them using e-mail or post to the server.

You can access the object using the launchbox.Logger reference.

To use the API it is necessary to set the attributes mentioned in a table below once the onLaunchboxLoaded method was called.

Log information originates from the following two sources:

  • the web application (using the standard console logger),

  • the Pega Client for Windows's native code, including custom modules.

In order to use the API you need to call the following from the web application:

console.error("This is an error message #" + messageId); 
console.warn("This is a warning message #" + messageId);
console.info("This is a info message #" + messageId);
console.debug("This is a debug message #" + messageId);

Note

The console.log level is equivalent to the console.info one.

The above log levels correspond to the log levels mentioned in the "Constants" section below. Before they are stored in the console or written to a file, all JavaScript and native logs are filtered based on the log level setting.

Module

This object belongs to the Base product module.

Constants

The table lists the allowed log level constants predefined for the Logger object. Log level definitions are in-line with the description given e.g. in the Android SDK documentation.

Name Description Value
window.launchbox.Logger.logLevel.SILENT

Denotes the SILENT log level.

No logs from the web application or the native code are returned.

0
window.launchbox.Logger.logLevel.ERROR Denotes the ERROR log level. 1
window.launchbox.Logger.logLevel.WARNING Denotes the WARNING log level. 2
window.launchbox.Logger.logLevel.INFO Denotes the INFO log level. 3
window.launchbox.Logger.logLevel.DEBUG Denotes the DEBUG log level. 4
window.launchbox.Logger.logLevel.VERBOSE

Denotes the VERBOSE log level.

Used solely for development purposes, returns all possible logs from the native code.

5

Note

Log levels are cumulative, therefore, when set to INFO level, the Logger API stores logs for INFO, WARNING and ERROR levels.

Attributes

The attributes of the Logger object are listed below:

Attribute Description Type
logLevel JavaScript property (get/set) accepting one of window.launchbox.Logger.logLevel constants. It is used to decide what logs are logged in the log file. By default it is set to "window.launchbox.Logger.logLevel.INFO". string

Note

All attribute settings are persisted between restarts.

Methods

Name Description
readLogTail

Returns a defined number of last log records in a string array. To operate, it requires the logToFile property to be set to "true".

clearLogFile

Removes any logs that have been stored in the files.

Legal notice | Copyright © 2018 and Confidential to Pegasystems Inc. All rights reserved
Pega Community | Feedback
Advanced...