IntelliJ IDEA 13.1 Web Help

In IntelliJ IDEA, debugging of Android applications is provided through support of the logcat functionality that stores a log of system debug output. The messages include a stack trace when the emulator throws an error, so you can navigate to the exception location in the source code.

The logcat functionality is handled by the Android Debugging Bridge (adb). This service supports interaction between your development environment, Android devices, emulators and other tools, for example, DDMS. Some of these tools may conflict with IntelliJ IDEA when the logcat functionality is enabled. Therefore, before switching from IntelliJ IDEA to an adb-managed tool, you need to disable logcat or exit IntelliJ IDEA.

In IntelliJ IDEA, the logcat functionality is available through the Logcat tab of the Android tool window. By default, the tab is activated automatically every time an application is deployed and launched successfully. You can suppress automatic showing of the tab by clearing the Show logcat automatically check box in the Run/Debug configuration: Android Application dialog box.

To improve the visibility of information in the tool window, you can restrict the range of messages to be displayed to a certain severity.

On this page:

Toggling the Logcat functionality on and off
  • To enable logcat, choose Tools | Android | Enable ADB Integration on the main menu.
  • To disable logcat, choose Tools | Android | Disable ADB Integration on the main menu.
Showing and hiding the Logcat tab automatically

By default, the Logcat tab is activated automatically every time an application is deployed and launched successfully. You can suppress automatic showing of the tab by clearing the Show logcat automatically check box in the Run/Debug configuration: Android Application dialog box.

  1. Start creating an Android run/debug configuration, see Creating an Android Run/Debug Configuration.
  2. On the Run/Debug Configuration: Android page that opens, specify the configuration name and choose the module to apply the current configuration to.
  3. Switch to the Logcat tab.
  4. Clear the Show logcat automatically check box.

Defining the range of messages to display

At any time during a debug session, you can switch to the Android tool window and define the range of messages to display. This can be done in three ways:

  • By restricting the displayed messages to those that refer to a specific process.
  • By appointing the relevant message priority in the Log Level area.
  • By filtering out messages according to user-defined filter configurations.

Showing only messages that refer to a specific process
  1. Open the Devices / Logcat tab and press the Only show logcat for selected process toggle button android_logcat_show_only_selected_process_messages.
  2. From the Device drop-down list, choose the physical device or the emulator where the debugged application is running.
  3. From the list that shows all the processes that are currently running ont he chosen device, select the process you are u=interested in. The Logcat pane shows only the messages that refer to the selected process.

Once you have pressed the toggle button, you do not need to release it and press anew to view the log on another process. Just keep the toggle button pressed and switch between processes and view the log for them.

Showing only messages with a certain priority
  • Open the Devices / Logcat tab and choose the priority of messages to display from the Log Level drop-down list on the toolbar. The available options are:
    • Verbose
    • Debug
    • Info
    • Warn
    • Error
    • Assert
Creating and applying filter configurations

A filter configuration is a set of filtering parameters. Applying filter configurations provides more flexible control over the type and amount of information displayed that just specifying the information type by choosing a message priority in the Log level drop-down list.

Open the Devices / Logcat tab and configure a list of filter configurations and appoint the relevant one to apply in the Filters are on the toolbar:

  • To have a filter applied, choose it from the Filter drop-down list.
  • To have all the log information displayed, choose No Filters from the drop-down list.
  • To create a new filter configuration, choose Edit Filter Configuration. In the Create New Logcat Filter dialog box that opens, click the Add toolbar button add.png and specify the filtering parameters based on various factors:
    • Log Tag: use this parameter to have only messages from a certain component displayed. Type the regular expression to specify the tag that indicates the relevant system component, such as activity, activity, etc.. For more details, see Filtering Log Output.
    • Log Message: use this parameter to have only messages that contain certain elements or character strings displayed. Type the regular expression the defines specify the character string to detect.
    • Package Name:use this parameter to have only messages that refer to a specific Java package (class path) displayed.
    • PID: use this parameter to have oly messages that refer to a specific process (process ID) displayed.
    • Log Level: use this parameter to have only messages with a certain priority displayed, see Filtering Log Output for details.

    To update a filter, select it in the list and change the filtering parameters.

  • To remove a filter configuration from the list, choose Edit Filter Configuration. In the Create New Logcat Filter dialog box that opens, select the filter and click the Delete toolbar button delete.png.

See Also

Concepts:

Procedures:

Reference:

Web Resources: