Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Receiving system logs info in Symbian Web Runtime

From Wiki
Jump to: navigation, search

This code snippet shows how to retrieve information from system logs in Symbian Web Runtime, using the Logging Platform Service (introduced in S60 5th Edition).

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: Service.Logging, Service.Logging.GetList()
Created: MiGryz (10 Dec 2008)
Last edited: hamishwillee (05 Oct 2012)



The device.getServiceObject("Service.Logging", "IDataSource") method is used to obtain access to the service object for the Contact Service API.

After setting the values for criteria.Type, the IDataSource.GetList(criteria) method is used to retrieve items from system logs.

Source file: LoggingView.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="">
<script type='text/javascript' src="LoggingView.js"></script>
<body onload="init()">
<div id="inputdata">
<select id="eventtype">
<button onclick="doRefresh()">Refresh</button><br/>
<!-- table for showing existing items -->
<table id="maintable" cellspacing='1' cellpadding='1' border='1'>

Source file: LoggingView.js

// logging system service object
var logger;
// system error code
var noItemsErrorCode = 1012;
* Initializes the widget

function init() {
// Obtain the service object
try {
logger = device.getServiceObject("Service.Logging", "IDataSource");
} catch(err) {
alert( "error receiving Logging service handle" );
// Refreshing info
* Refreshes information in table

function doRefresh() {
var criteria = new Object();
criteria.Type = "Log";
criteria.Filter = new Object();
criteria.Filter.EventType =
// making a call to service to receive a list of suitable items
var logs;
try {
logs = logger.IDataSource.GetList(criteria);
}catch(err) {
alert("error receiving log items");
var table = document.getElementById('maintable');
// cleaning table and adding header
while(table.rows[0] != undefined) {
table.rows[0].innerHTML = "<th>EventType</th><th>EventDuration</th>" +
if(logs.ErrorCode != 0) {
// If the error code is not "no suitable items", show an alert.
// Otherwise just leave the function.
if(logs.ErrorCode != noItemsErrorCode) {
alert( logs.ErrorMessage );
} else {
// filling table with received data
var table = document.getElementById('maintable');
var i; // iterator
var item; // pointer to item in received list
for(i = 0; (item = logs.ReturnValue.getNext()) != undefined; ++i) {
table.insertRow(i + 1);
var result = "<td>";
if(item['EventType'] != undefined) {
result += item['EventType'];
result += "</td><td>";
if(item['EventDuration'] != undefined) {
result += item['EventDuration']
result += "</td><td>";
if(item['Subject'] != undefined) {
result += item['Subject'];
result += "</td><td>";
if(item['Description'] != undefined) {
result += item['Description'];
result += "</td>";
table.rows[i + 1].innerHTML = result;


  • After loading a table with all logs is shown.
  • Pressing the "Refresh" button refreshes the table.
  • The drop-down list allows you to choose what type of logs you would like to see.

Supplementary material

You can view the source file and executable application in the attached ZIP archive. The archive is available for download at Media:Receiving system logs info in

This page was last modified on 5 October 2012, at 06:38.
48 page views in the last 30 days.