Tracing the MQTT client for C
Set the environment variable MQTT_C_CLIENT_TRACE to trace an MQTT client C app
Before you begin
MQTT client for C trace is available for both the pre-built Windows and Linux® MQTT client for C libraries, and for the iOS libraries you build yourself.
About this task
Set the environment variable MQTT_C_CLIENT_TRACE to a path to a file that is to contain the trace output. Trace output is written to the file.
Procedure
Set MQTT_C_CLIENT_TRACE=mqttcclient.log before
running your MQTT client
C app.
Results
=========================================================
Trace Output
=========================================================
19700101 000000.000 (8084) (1)> Socket_outInitialize:113
19700101 000000.000 (8084) (2)> SocketBuffer_initialize:81
19700101 000000.000 (8084) (2)< SocketBuffer_initialize:85
19700101 000000.000 (8084) (1)< Socket_outInitialize:129
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> MQTTPersistence_create:43
19700101 000000.000 (8084) (1)< MQTTPersistence_create:89 (0)
19700101 000000.000 (8084) (1)> MQTTPersistence_initialize:104
19700101 000000.000 (8084) (1)< MQTTPersistence_initialize:112 (0)
19700101 000000.000 (8084) (0)< MQTTClient_create:267 (0)
19700101 000000.000 (8084) (0)> MQTTClient_connect:701
19700101 000000.000 Connecting to serverURI localhost:1883
20130201 125912.234 (8084) (1)> MQTTProtocol_connect:93
20130201 125912.234 (8084) (2)> MQTTProtocol_addressPort:43
20130201 125912.234 (8084) (2)< MQTTProtocol_addressPort:68
20130201 125912.234 (8084) (2)> Socket_new:594
20130201 125912.234 New socket 1860 for localhost, port 1883
Trace Output
=========================================================
19700101 000000.000 (8084) (1)> Socket_outInitialize:113
19700101 000000.000 (8084) (2)> SocketBuffer_initialize:81
19700101 000000.000 (8084) (2)< SocketBuffer_initialize:85
19700101 000000.000 (8084) (1)< Socket_outInitialize:129
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> Thread_create_sem:189
19700101 000000.000 (8084) (1)< Thread_create_sem:222 (0)
19700101 000000.000 (8084) (1)> MQTTPersistence_create:43
19700101 000000.000 (8084) (1)< MQTTPersistence_create:89 (0)
19700101 000000.000 (8084) (1)> MQTTPersistence_initialize:104
19700101 000000.000 (8084) (1)< MQTTPersistence_initialize:112 (0)
19700101 000000.000 (8084) (0)< MQTTClient_create:267 (0)
19700101 000000.000 (8084) (0)> MQTTClient_connect:701
19700101 000000.000 Connecting to serverURI localhost:1883
20130201 125912.234 (8084) (1)> MQTTProtocol_connect:93
20130201 125912.234 (8084) (2)> MQTTProtocol_addressPort:43
20130201 125912.234 (8084) (2)< MQTTProtocol_addressPort:68
20130201 125912.234 (8084) (2)> Socket_new:594
20130201 125912.234 New socket 1860 for localhost, port 1883