Display Logs for the Android Client
You can log the messages sent and received by your Android client, as well as connection information, using the java.util.logging.Logger and java.util.logging.Level classes and the LogCat console included with the Eclipse ADT plugin.
Before You Begin
This procedure is part of Checklist: Build Android Clients Using Kaazing WebSocket Gateway:
- Use the Kaazing WebSocket Gateway Android Client API
- Secure Your Java and Android Clients
- Display Logs for the Android Client
Note: Learn about supported browsers, operating systems, and platform versions in the Release Notes.
To Enable Android Client Logging
- Build your Android client as described in Use the Kaazing WebSocket Gateway Android Client API.
- In the Eclipse project for your Android client, import the java.util.logging classes
import java.util.logging.Level; import java.util.logging.Logger;
- In the
onCreate()
method, add the following statements:Logger logger = Logger.getLogger("com.kaazing.net.ws.client"); logger.setLevel(Level.FINE);
- Save your Eclipse project.
- In Eclipse, click Window, click Show View, and then click Other.
- In Show View, click LogCat and then click OK.
- Run your Android client in the Android Emulator or on a device.
- Look at the LogCat console to see the messages in the log.
See Also
You have completed the Android client checklist. For more information about the Kaazing WebSocket Gateway Android Client API, see Kaazing WebSocket Gateway Android Client API.