1

I made an android app that uses the aws cognito sdk to login to a user pool. This returns the 3 tokens (id, access, refresh) and I can then call my api gateway. This all works, no problems. However, when I am debugging the app I can't see the call that my app makes to cognito to get these tokens. I have tried adding the verbose logging as per https://docs.aws.amazon.com/mobileanalytics/latest/ug/sdk-logging.html but that hasn't worked. There are 5 endpoints described in the docs https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html but none of them seem to take in the username/password.

user1584120
  • 1,169
  • 2
  • 23
  • 44
  • So your question is 'which of the endpoints is the SDK calling for login?' (https://docs.aws.amazon.com/cognito/latest/developerguide/login-endpoint.html)? Or 'how to make SDK log the full URL with all the headers and params'? :) – Lech Migdal Sep 02 '18 at 06:02
  • I'll take either but the logging one would be especially handy for later issues – user1584120 Sep 02 '18 at 15:09

1 Answers1

1

SDK uses Apache Commons Logging library(JCL) if it is present in the classpath else it uses android.util.Log. Using JCL: JCL is a wrapper for popular logging APIs such as Log4J, logback etc. If your app does not take a dependency on any of these, common logging library defaults to java.util.logging package present in JDK. Configuration of the behavior of the JCL ultimately depends upon the logging toolkit(log4j, logback etc.) being used. Please refer the documentation for the chosen logging system to adjust the log level. If you are defaulting to java.util.logging package, you can change log level as follows :

Add logging.properties file to res/raw and add following to onCreate of the MainActivity

logger = Logger.getLogger(PubSubActivity.class.getName());
InputStream raw = getResources().openRawResource(R.raw.logging);
LogManager lManager = LogManager.getLogManager();
lManager.readConfiguration(raw);

Using Android Log : There is no way to change log level for entire SDK in this case. However as a workaround to change log levels for debugging purposes you can change it for a specific tag with the following command: adb shell setprop log.tag.<YOUR_LOG_TAG> <LEVEL>

Roshan
  • 753
  • 5
  • 14