Overview
Enterprise Browser includes a powerful logging engine, offering administrators, developers and tech support teams the potential to access a rich, multi-level data streams relating to application execution, events and failures for debugging an app and analyzing events following a crash or other failure. This guide explains how to enable logging, select logging levels, send messages to the log and to retrieve the log file.
Logging is hierarchical, and log-event settings in the Config.xml
file can override or be overridden by others. See the Logger section of the Config.xml Reference for more information.
Enabling Logging
Logging for an Enterprise Browser app is controlled in the Logger section of the app's Config.xml
file.
The five levels of log messages:
LogError - Controls logging of ERROR messages generated by an Enterprise Browser app. If set to 1, it enables error-level logging only (overridden by LogWarning).
LogWarning - Controls the logging of WARNING messages generated by an Enterprise Browser app. If set to 1, enables warning and error messages (overrides LogError setting; overridden by LogInfo).
LogInfo - Controls the logging of INFORMATION messages generated by an Enterprise Browser app. If set to 1, enables Info, Warning and Error logging (overrides LogWarning and/or LogError settings; overridden by LogUser).
LogUser - Controls logging of User, Info, Warning and Error messages from the user application (overrides LogWarning, LogError and/or LogInfo settings). Data can be logged using the Log API.
LogMemory - Controls the logging of memory usage in the system. Supports Android, WM/CE; does not apply to the Enterprise Tablet.
The <Logger> section of the Config.xml
file is shown below with its default settings. To enable a logging of a particular event, change the value in the event's tag to "1" as shown below for Error, Warning and Info events:
<Logger>
<LogProtocol value="FILE"/>
<LogPort value="80"/>
<LogURI value="file://%INSTALLDIR%/Log.txt"/>
<LogError value="1"/>
<LogWarning value="1"/>
<LogInfo value="1"/>
<LogTrace value="0"/>
<LogUser value="0"/>
<LogMemory value="0"/>
<LogMemPeriod value="5000"/>
<LogMaxSize value="5000"/>
</Logger>
Logging Options
Enterprise Browser logging offers the following additional options:
LogProtocol - Sets the protocol (File or HTTP) over which the logging data will be sent (accepts any valid URL or fully qualified path and file name).
LogPort - The port over which the logging data will be sent when HTTP is set in LogProtocol; otherwise ignored (accepts any valid HTTP port number).
LogURI - The URL or file name and path to which logged data should be sent or saved (accepts any valid URL or fully qualified path and file name).
LogMemPeriod - Specifies the time interval (in ms) after which memory logs will be generated (accepts an integer). Supports Android and WM/CE; does not apply to the Enterprise Tablet.
LogMaxSize - Specifies the maximum allowable size (in KB) of the log file, after which no more logs will be saved (accepts an integer).
Logging Messages
For added visibility into an app, log messages can be invoked from program code. The easiest way to do this is usually to add a print statement to the segment where insight is needed. In JavaScript, this is done via the console.log()
method. For instance, to gain visibility into the contents of the variable "name," try something like to the following:
var name = "firstName";
console.log("Name: " + name);
The name set by this code will be printed to the log file in the form of a line with the contents "Name: firstName." This is a useful way to determine if the data in an app is formed as expected. If the result is a null value on a variable is supposed to have data, print it to the log file to make sure it's actually getting defined.
Retrieving the Log File
Once the log contains sufficient data, it might be desirable to view the logs periodically to gain insight into what's happening in the app. The location of the log file varies depending on the platform.
Path to log file:
- On Android devices:
/sdcard/Android/data/com.symbol.enterprisebrowser/
- On Windows devices:
\Program Files\EnterpriseBrowser\log\
Related Guide: