IntelliJ Platform Plugin SDK Help

IDE Infrastructure

Logging

The IntelliJ Platform uses Logger abstraction class to shield from underlying logging implementation and configuration.

Plugins should obtain a dedicated instance:

import com.intellij.openapi.diagnostic.Logger; public class MyPluginClass { private static final Logger LOG = Logger.getInstance(MyPluginClass.class); public void someMethod() { LOG.info("someMethod() was called"); } }
import com.intellij.openapi.diagnostic.logger private val LOG = logger<MyPluginClass>() class MyPluginClass { fun someMethod() { LOG.info("someMethod() was called") } }

If logging is used only to report exceptions, use convenience method thisLogger():

try { // some code } catch (e: Throwable) { thisLogger().error("some code failed", e) }

By default, all messages with level INFO and higher are written to log output file idea.log. To enable DEBUG/TRACE logging for specific categories, use Help | Diagnostic Tools | Debug Log Settings.

To locate the log file, choose the Help | Show Log in Finder/Explorer action. When internal mode is enabled, the currently running IDE log file can be opened using Help | Open Log in Editor.

To locate it for a specific installation, see this Knowledge Base article. See Development Instance Sandbox Directory on how to find it for development instances.

See Testing FAQ on how to enable DEBUG/TRACE level logging during tests, and obtain separate logs for failing tests.

To provide additional context for reporting fatal errors, use Logger.error() methods taking additional Attachment (see AttachmentFactory).

Error Reporting

The IDE will show fatal errors caught by itself as well as logging messages with ERROR level in the IDE Fatal Errors dialog:

  • for IDE platform: in EAP releases or when running in internal mode

  • for third-party plugins: always

For the latter, reporting is disabled by default — instead, there's an option to disable the plugin causing the exception.

To let users report such errors to the vendor, plugins can implement custom ErrorReportSubmitter registered in com.intellij.errorHandler extension point. See IntelliJ Platform Explorer for existing implementations — ranging from pre-filling web-based issue tracker forms to fully automated submission to log monitoring systems. This tutorial also offers a working solution for using Sentry.

To disable red exclamation notification icon in status bar, invoke Help | Edit Custom Properties... and add idea.fatal.error.notification=disabled in opened idea.properties.

Runtime Information

ApplicationInfo provides information on the IDE version and vendor. NOTE: to restrict compatibility, declare IDEs and versions via plugin.xml.

To obtain information about OS and Java VM, use SystemInfo.

To access relevant configuration directories, see PathManager.

To obtain unique installation UUID, use PermanentInstallationID. For paid plugins, see also Marketplace docs.

Context Help

To show custom context web-based help for your plugin's functionality (e.g., for dialogs), provide WebHelpProvider registered in com.intellij.webHelpProvider extension point.

Running Tasks Once

Use RunOnceUtil to run a task exactly once per project/application.

Application Events

Application lifecycle events can be tracked via AppLifecycleListener listener. See also Application Startup and Project and Application Close.

Register ApplicationActivationListener listener to be notified of "application focused/unfocused" events.

To request restart of the IDE, use Application.restart()

Launching Browser

Use BrowserLauncher.

Open File in System File Manager

Use RevealFileAction.openFile() or openDirectory().

Theme Change

Use LafManagerListener topic to receive change notifications (e.g., to refresh UI).

Power Save Mode

File | Power Save Mode can be enabled to limit power-consuming features on laptops. Use PowerSaveMode service and PowerSaveMode.Listener topic to disable such features in your plugin accordingly.

Plugin Management

Installed plugins can be checked via PluginManagerCore.isPluginInstalled().

Plugin Suggestions

For specific features (e.g., File Type, Facet, ...), the IDE will suggest installing matching plugins automatically. See Plugin Recommendations in Marketplace documentation for details.

To suggest other relevant plugins, use PluginsAdvertiser.installAndEnable().

Deprecating a Plugin

To suggest replacing the currently installed deprecated plugin with the new one, implement PluginReplacement registered in com.intellij.pluginReplacement extension point.

Last modified: 09 January 2024