Debug Logging

Overview

There are three types of debug logging which can be enabled for the server. Each of these types of debug logging is activated by enabling one of the following macros in the server’s MMP file (app-engines\cntmodel\cntsrv\cntsrv.mmp):

  • __VERBOSE_DEBUG__
  • __STATE_MACHINE_DEBUG__
  • __PROFILE_DEBUG__

Verbose Debug Logging

Enabling the __VERBOSE_DEBUG__ macro activates a variety of debug logging.

IPC Calls

One of the more useful forms of verbose debug logging is for IPC calls. The following type of debug is emitted for each IPC call received by a session on the server:

IPC: ECntCompress, SessId: 4, ErrCode: 0

The debug indicates the IPC call op-code and the ID of the session that is handling the IPC call. The error code will always be 0 in this case.

If an IPC call leaves on the server then the following type of debug is emitted:

IPC_ERROR: ECntCompress, SessId: 4, ErrCode: -4

The debug indicates the IPC call op-code, the ID of the session that is handling the IPC call and the error code for the leave.

Database Events

Another useful form of verbose debug logging is for database events. The following type of debug is emitted for each database event that is queued by the server:

->Q: Message: EContactDbObserverEventContactAdded, ContactID: 2, ConnectionId: 2

For each event that is transferred from the server to the client the following type of debug is emitted:

Q->: Message: EContactDbObserverEventContactAdded, ContactID: 1, ConnectionId: 2

State Machine Debug Logging

Enabling the __STATE_MACHINE_DEBUG__ macro activates state machine transition debug logging.

Each time the state machine changes state a line of debug will be emitted. This indicates between which states the state machine is making a transition. For example:

STA: EStateClosed --> EStateOpening

This indicates that the state machine is in transition between the Closed and Opening states.

Profile Debug Logging

Enabling the __PROFILE_DEBUG__ macro activates profile debug logging. This form of debug logging indicates which methods are being called in order to identify paths of execution for optimisation. For example:

MTD: CCntSession::ServiceL
MTD: CCntSession::CntItemManagerL
MTD: CCntSession::ServiceL
MTD: CCntSession::CntItemManagerL
MTD: CCntSession::ServiceL
MTD: CCntSession::CntItemManagerL
MTD: CCntStateMachine::ProcessRequestL
MTD: CCntStateMachine::HandleDatabaseEventL
MTD: CCntSession::ServiceL
MTD: CCntSession::CntItemManagerL
MTD: CCntStateMachine::ProcessRequestL
MTD: CCntStateMachine::HandleDatabaseEventL
MTD: CCntSession::ServiceL
MTD: CCntSession::CntItemManagerL
MTD: CCntStateMachine::ProcessRequestL 
MTD: CCntStateMachine::HandleDatabaseEventL
MTD: CCntSession::ServiceL 
MTD: CCntSession::CntItemManagerL
MTD: CCntStateMachine::ProcessRequestL 
MTD: CCntStateMachine::HandleDatabaseEventL
MTD: CCntSession::ServiceL 
MTD: CCntSession::CntItemManagerL 
MTD: CCntStateMachine::ProcessRequestL
MTD: CCntStateMachine::HandleDatabaseEventL
MTD: CCntSession::ServiceL
MTD: CCntSession::CntItemManagerL

This table shows the methods called on the server when adding a series of contact items.