The Console desktop tool enables you to capture console output, the same as what you currently see in Qt Creator, from an AppStudio app using a desktop tool. As with the Qt Creator console, the Console tool can be used with an app running on the same machine, but it can also receive output from another device on the same network. This is ideal for capturing console output from your iOS or Android device and viewing it on your desktop.
Enable the Console tool
When you start AppStudio for ArcGIS version 1.2 or later, you'll see the Console icon in the toolbar at the top of the app. This opens the Console tool.
Access to this tool does not require you to sign in.
Aside from the host computer's details, this page at first appears empty, as an app needs to be directed to a console before information will be outputted to it. This can only be done in an AppStudio app that has logging enabled.
Enable logging in Player
For in-development or enterprise apps, Player has built-in compatibility with the console. To enable logging in Player, open the side menu and press the Connect remote console option. Click the Enable Logging toggle key to display the options for the logging mode. You must then choose from three different methods to connect to your device.
- Scan QR code is useful when running apps in Player on mobile devices. Before scanning the code, select the IP address in the Console tool. Since the system running the AppStudio console may have multiple IP addresses assigned to it, the QR code will be generated for the address selected from the drop-down list and appear beside it. Clicking this QR code displays a larger version, which is useful if the device is unable to scan the smaller code. Scan the generated QR code at either size to complete the connection.
- Connect via network allows you to choose a currently running AppStudio console on your network to complete the connection.
- Enter IP Address opens a new page where you manually enter the IP address and port; for example, syslog://10.112.25.174:514. Press Next to connect to the console.
With all of these methods, all actions you perform in Player will send messages to the console on your selected desktop.
Log messages with Console
Once Player has been connected to the Console tool, the Log output locations field automatically populates with the connected device's details.
The console on your selected desktop will immediately display diagnostic information from both Player and the app running in it. Messages from Player and the app are distinguished in the App column. The console will receive information until you either disable logging in Player or click Stop in the console.
Log to other consoles online
The Console tool uses the syslog protocol, a widely supported and compatible means of logging information within a network or online. This means that the logging capabilities of Player, and console-supporting apps, can be used to send messages to other syslog consoles such as Loggly.
To do this, manually enter the URL or IP address of your syslog location into the Log output location text box. You may also need to provide user ID information. Enter this in the User data text box. To learn more about user ID information and Loggly, refer to Loggly's documentation.
Save logged console messages to a file
The Console tool can also export the messages received to a log file that can be referred to later or sent to others. To do this, click the Save button in the console either during or after logging. A dialog box appears where you choose the file destination and name, and save the results as a .log file.
Add console compatibility to your app
You can add the ability to output console messages to your own app. At a minimum, the following line of code will allow your app to output console messages to an external log file in the default location on the device:
AppFramework.logging.enabled = true;
To ensure this file can be created when running your app on an Android device, in Settings, on the Capabilities tab, confirm that External Storage is selected.
For more detailed examples of how logging can be implemented, see the enterprise templates of Player and Survey123 supplied with AppStudio.