I have followed examples and docs to run MqttAndroidClient and successfully connect and pub/sub with mosquito broker, both in open and secure to ports 1883, 8883, 8884, & 8885. This success is built with this: implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1 implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0
But to connect to AWS IOT, I need the SNI extension added to mqttv3:1.2.3 or later. Keeping it simple for now, just still connecting with mosquito broker, connection fails as soon as I use mqttv3:1.2.1 or later.
So I need to enable the mqttv3 logging to diagnose why, but I am bewildered on how to do it in Android Studio even after looking over some similar questions for command line invocation of java.
I have added the AndroidClient logging:
mqttClient = MqttAndroidClient(context, serverURI, "PleaseHelpMeLog")
mqttClient.setTraceCallback(object : MqttTraceHandler {
override fun traceDebug(tag: String?, message: String?) {
Log.d("$tag", "$message")
}
override fun traceError(tag: String?, message: String?) {
Log.d("$tag", "$message")
}
override fun traceException(tag: String?, message: String?, e: java.lang.Exception?) {
Log.d("$tag", "$message")
}
}
)
mqttClient.setTraceEnabled(true)
And I got the source of the failure in an AndroidClient log: connect fail, call connect to reconnect.reason:MqttException
But this is not the mqttv3 logging, which I would need for what leads up to "MqttException".
If I could get to the mqttClient used by the AndroidClient, I understand that I could use something like mqttDebug = mqttClient.getDebug() and then mqttDebug.dumpClientDebug()
How can this be enabled in an Android Studio build?
I have found a way to enable the FINE logs from Paho buried in this AWS-Amplify issue: https://github.com/aws-amplify/aws-sdk-android/issues/3022