Genesys Engage on-premises

 View Only
Discussion Thread View
Expand all | Collapse all

GMS Android SDK - Setting some detailed log level

  • 1.  GMS Android SDK - Setting some detailed log level

    Posted 09-22-2020 11:20
    Hi 

    We are trying to get the errors in the GMS Sample provided for android.  The iOS works fine.  

    What we noticed is the logs generated by android is very high level, cannot find a way to produce more detailed log like iOS.  

    Android only prints 
    D/MainActivity: Main Activity created
    D/ConnectFragment: Initialize data
    D/ConnectFragment: Load default data
    D/ConnectFragment: Initialize Spinner

    We are stuck trying to figure out why these exceptions show up in the app.  Please advice on how best to enable logging for easier debugging.

    Thanks
    (1) 2020-09-21 19:30:39.584 15406-15881/xxxI/ClientSession: Exception while invoking listener com.genesys.gms.mobile.client.CometClient$5$1@7aff874
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
    at com.genesys.gms.mobile.client.ChatClient.onNewMessage(ChatClient.java:170)
    at com.genesys.gms.mobile.client.CometClient$5$1.onMessage(CometClient.java:354)
    at org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:594)
    at org.cometd.common.AbstractClientSession.notifyListener(AbstractClientSession.java:310)
    at org.cometd.common.AbstractClientSession.notifyListeners(AbstractClientSession.java:285)
    at org.cometd.common.AbstractClientSession.receive(AbstractClientSession.java:257)
    at org.cometd.client.BayeuxClient.failMessage(BayeuxClient.java:843)
    at org.cometd.client.BayeuxClient.messageFailure(BayeuxClient.java:839)
    at org.cometd.client.BayeuxClient.messagesFailure(BayeuxClient.java:670)
    at org.cometd.client.BayeuxClient$MessageTransportListener.onFailure(BayeuxClient.java:1195)
    at org.cometd.client.transport.LongPollingTransport$2.onComplete(LongPollingTransport.java:214)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:454)
    at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:535)
    at org.eclipse.jetty.client.HttpChannel.abortResponse(HttpChannel.java:129)
    at org.eclipse.jetty.client.HttpChannel.abort(HttpChannel.java:122)
    at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:257)
    at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
    at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:704)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.abort(HttpConnectionOverHTTP.java:172)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.close(HttpConnectionOverHTTP.java:160)
    at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onReadTimeout(HttpConnectionOverHTTP.java:113)
    at org.eclipse.jetty.io.AbstractConnection.onFillInterestedFailed(AbstractConnection.java:173)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback$1.run(AbstractConnection.java:586)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:919)
    #ArchitectureandDesign
    #Integrations
    #Unsure/Other

    ------------------------------
    Dora Potluri
    ------------------------------


  • 2.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-23-2020 04:11
    @ Dora Potluri,

    Since there is an failure and SDK is trying to retrieve the reason for the failure. when trying to retrieve the reason, message received doesn't contain "Message.ERROR_FIELD", resulting in null pointer exception.

    Code snippet:
    if (message.get(Message.SUCCESSFUL_FIELD) != null && message.get(Message.SUCCESSFUL_FIELD).toString().equals("false")) { chatHandler.onError(new MessageException(message.get(Message.ERROR_FIELD).toString())); return; }​

    https://docs.cometd.org/current4/apidocs/org/cometd/bayeux/Message.html



    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 3.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-23-2020 10:56
    Edited by Dora Potluri 09-23-2020 10:56
    @Prasath Balakrishnan

    For us to be able to understand what is the field missing, how can we enable better logging for SDK?  We are struggling with it on android side. 

    ​On iOS we see good log.  But on android it is really lacks any such useful capability to debug.

    The existing demo / sample android client has several issues.  One of the major ones is as follows:

    Please help.

    Step 1: Initiate fresh chat able to receive response from the server.
    Step 2: Send message from the client side and able to receiver response from the server.
    Step 3: Exit chat screen with disconnect call got success response from the server.  There is no method apart from disconnect on the client to clean up the resources on the SDK.  
    Step 4: Re-launch chat screen and try to send message from the client side and got below response from server.  
    [{
    "data": {
    "messages": [],
    "chatEnded": false,
    "statusCode": 2,
    "errors": [{
    "code": 154,
    "advice": "Missed chatId"
    }, {
    "code": 153,
    "advice": "Missed secureKey"
    }, {
    "code": 152,
    "advice": "Missed userId"
    }, {
    "code": 151,
    "advice": "Missed alias"
    }]
    },
    "channel": "/service/chatV2/CE18_Digital_Chat"
    }, {
    "channel": "/meta/connect",
    "id": "82",
    "successful": true
    }]

    ---------------------------------------------------------

    [{
    "data": {
    "messages": [],
    "chatEnded": true,
    "statusCode": 2,
    "alias": "0",
    "secureKey": "JChCZzwoHBQdERMLMjA3AhgJQEFSDhsRQ29TWUESMjVDNj01bDs/Rw==",
    "userId": "deprecated",
    "chatId": "deprecated",
    "errors": [{
    "code": 240,
    "advice": "Unexpected error occurred. ReferenceId[10000253]"
    }]
    },
    "channel": "/service/chatV2/CE18_Digital_Chat"
    }, {
    "channel": "/meta/connect",
    "id": "19",
    "successful": true
    }]

    ------------------------------
    Dora Potluri
    ------------------------------



  • 4.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 00:30
    @Dora Polturi,

    At Step 3,
    • Disconnect call will clear all the resources on the SDK. ​
    • After disconnect, the chat session ends. A new session has to be initiated(after Step 3 ->  Step 1)

    Regarding Logs please let me know the version of SDK used.

    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 5.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 09:11
    @Prasath Balakrishnan

    Rest assured we are are creating a new session.  You can try with the demo app, just connect it and go through the steps outlined above.  And close the chat which will disconnect.  Now come back to start a new session and you will see the error.  The sample/demo app has this issue.

    We are using implementation 'com.genesys.gms.android:sdk:8.5.201.00.rev.8cfdca3'.

    Here are snippets of code
    val initialSetting = Settings()
    initialSetting.firstName = sharedLoginUserInfo.currentSelectedAccountInfo.customerName
    initialSetting.lastName = sharedLoginUserInfo.currentSelectedAccountInfo.customerName
    initialSetting.userName = sharedLoginUserInfo.currentSelectedAccountInfo.customerName

    initialSetting.displayName = sharedLoginUserInfo.currentSelectedAccountInfo.customerName
    initialSetting.email = sharedLoginUserInfo.currentSelectedAccountInfo.yesId
    initialSetting.subject = "Genesys Mobile Services Demo"


    initialSetting.hostname = "xxxxxxxxxxxx"
    initialSetting.port = 48090
    initialSetting.isSecureProtocol = true
    initialSetting.app = "genesys"
    initialSetting.serviceName = "request-chat"
    initialSetting.serviceNameV2 = "CE18_Digital_Chat"​

    We are calling below things on onCreate
    /**
    * This function is do server configuration setup for live chat.
    */
    private fun doSetUpForLiveChat() {
    settingsMgr = SettingsManager.createInstance(this, this)
    settingsMgr?.saveDatas(getChatSettings())
    chatClient = ChatClient(this, this, MySSLSocketFactory.getInstance().sslContextFactory)
    chatClient?.connect()

    }

    And for disconnect we are using this function :
    chatClient?.disconnect()


    You can try this on your sample app to go through and connect/disconnect and connect again and you will see the error.  

    Please help!!!

    Thank you so much in advance

    ------------------------------
    Dora Potluri
    ------------------------------



  • 6.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 09:26
    Edited by Prasath Balakrishnan 09-24-2020 09:30
    @Dora Polturi,

    Please test it with our android sample and the same SDK used. It works with our sample. 
    what is the status of agent when you are requesting for new chat session? is the previous chat session on the agent side has ended?

    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 7.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 09:36
    @Prasath Balakrishnan

    The chat (previous one) has ended.   This is the demo/sample code and I can assure you 100% it is not working for us. 

    The sad part is SDK does not have any capability to produce the logs like iOS (you can see my original request).

    We will be happy to host a 10 mins zoom call or skype to show you.  The sample for sure has issue on the reconnect 100%.   ​​

    ------------------------------
    Dora Potluri
    ------------------------------



  • 8.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 09:43
    @Dora Polturi, 

    The code snippet shared is not from our android sample. ​I'm right now looking into our sample, i can assure you this issue is not reproducible with our sample code. Regarding logs, i can add some and share you the library. But I'm certainly sure issue is not in the SDK.

    We(me & QA) tested the very steps you have mentioned. we never came across this issue.

    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 9.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 09:55
      |   view attached
    @Prasath Balakrishnan

    Please see the full code enclosed.  This is from genesys code

    Here are the steps
    Step 1: Initiate fresh chat able to receive response from the server.
    Step 2: Send message from the client side and able to receiver response from the server.
    Step 3: Exit chat screen with disconnect call got success response from the server.
    Step 4: Re-launch chat screen and try to send message from the client side and got below response from server.
    [{
    "data": {
    "messages": [],
    "chatEnded": false,
    "statusCode": 2,
    "errors": [{
    "code": 154,
    "advice": "Missed chatId"
    }, {
    "code": 153,
    "advice": "Missed secureKey"
    }, {
    "code": 152,
    "advice": "Missed userId"
    }, {
    "code": 151,
    "advice": "Missed alias"
    }]
    },
    "channel": "/service/chatV2/CE18_Digital_Chat"
    }, {
    "channel": "/meta/connect",
    "id": "82",
    "successful": true
    }]

    High level steps in code
    chatClient.connect();
    chatClient.sendMessage(sendText.getText().toString());
    chatClient.disconnect();


    We will be happy to try the new SDK with more log.  It should not take us long. 

    Source: https://bitbucket.org/genesysdevfoundry/gms-sample-android/src/master/


    ​​

    ------------------------------
    Dora Potluri
    ------------------------------

    Attachment(s)

    txt
    ChatActivity.txt   16 KB 1 version


  • 10.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 10:21
    one last question

    Step 4: when chat is relaunched, did the chat screen display "xxx joined the conversation".

    Note: xxx is the name of the agent

    ref: https://bitbucket.org/genesysdevfoundry/gms-sample-android/src/master/


    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 11.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 10:30
      |   view attached
    @Prasath Balakrishnan​​​


    On your sample demo app, it does not show anything.  I am including screenshot so you can see it yourselves.

    Sample UI - From Genesys

    But if you see the ADB log cat you can see, for sure you can see the difference.
    adb


    ------------------------------
    Dora Potluri
    ------------------------------



  • 12.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 10:37
    Please share the chat screen screenshot from the device

    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 13.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 10:41
    @Prasath Balakrishnan

    Sorry I do not get you.   Can you please advice what screen you want?

    ------------------------------
    Dora Potluri
    ------------------------------



  • 14.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 10:43
    Chat session started
    i want this screen after executing step 4 and the logs from the device or simulator from step 1 to step 4.


    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 15.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 10:55
    @Prasath Balakrishnan

    After Step4 the UI shows nothing.  It shows blank.

    Do you want me to share your demo APK or share the settings to our server (which is available on internet).  You can try it youself both of it.

    I can email you the settings, do not want to put it on the forum. But I do not believe i have your email address.  

    Please advice,

    step4


    ------------------------------
    Dora Potluri
    ------------------------------



  • 16.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 11:01
    @Dora Potluri,

    logs please.

    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 17.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 11:02
    Here is your log (i think this is timber) and adb log.

    @Prasath Balakrishnan

    Hope that helps.​

    ------------------------------
    Dora Potluri
    ------------------------------

    Attachment(s)

    txt
    log.txt   49 KB 1 version
    txt
    GMS demo log.txt   51 KB 1 version


  • 18.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-24-2020 11:16
    UI freezing seems to be result of the below exception

    2020-09-24 20:26:01.692 24442-24442/com.genesys.gms.mobile.gms_app I/ClientSession: Exception while invoking listener com.genesys.gms.mobile.client.CometClient$2$1@130340f
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
    at com.genesys.gms.mobile.client.ChatClient.onNewMessage(ChatClient.java:166)
    at com.genesys.gms.mobile.client.CometClient$2$1.onMessage(CometClient.java:158)

    can you check from the server end how to add the missing "ERROR_FIELD" as i mentioned earlier.
    I will add logs to the SDK and publish the same. you shall get the SDK in couple of days.


    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



  • 19.  RE: GMS Android SDK - Setting some detailed log level

    Posted 09-24-2020 11:20
    @Prasath Balakrishnan

    Thanks our server team seems unaware on where to add this. Any pointers on where this will go?  Even if there is a pointer to documentation we can take it from there.



    ------------------------------
    Dora Potluri
    ------------------------------



  • 20.  RE: GMS Android SDK - Setting some detailed log level

    GENESYS
    Posted 09-30-2020 01:33
    Edited by Prasath Balakrishnan 09-30-2020 01:33
    HI Dora Polturi,

    Please share GMS Server logs.

    ------------------------------
    Prasath Balakrishnan
    Genesys - Employees
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources