Capture console output
The Console desktop tool allows 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, you can use the Console tool 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.
When running an AppStudio app on an Android device and the application crashes, you can retrieve the generated system log files to perform diagnostics and troubleshooting. This requires the use of Android SDK tools. For more information, see the knowledge base article How to export a crash log (logcat) from an Android device.
When you start ArcGIS AppStudio version 1.2 or later, you'll see the Console button in the toolbar at the top of the app. This opens the Console tool.
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.
For in-development or enterprise apps, AppStudio Player has built-in compatibility with the console. To enable logging in the player, open the side menu and press the Connect remote console option. You must then choose from three different methods to connect to your device.
Scan QR code is useful when running apps in AppStudio 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. Select Next to connect to the console.
With all of these methods, all actions you perform in AppStudio Player will send messages to the console on your selected desktop.
Once AppStudio 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 AppStudio Player and the app running in it. Messages from the player and the app are distinguished in the App column. The console will receive information until you either disable logging in AppStudio Player or click Stop in the console.
The Console tool uses the syslog protocol, a widely supported and compatible means of logging information within a network or online. This means that you can use the logging capabilities of AppStudio Player and console-supporting apps 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.
The Console tool can also export the messages received to a log file that you can refer to later or send to others. To do this, click the Save button in the console either during or after logging. A dialog box appears, allowing you to choose the file destination and name and save the results as a
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;
For more detailed examples of how you can implement logging, see the enterprise templates of AppStudio Player and ArcGIS Survey123 supplied with AppStudio.