ReSharper Platform SDK
 
Because ReSharper Platform SDK undefined is still in development, this documentation may not be entirely accurate and is subject to change.

Advanced Configuration

Last modified: 04 July 2023

While logging can be enabled on the command line), specifying a configuration file allows for much more flexibility in what gets logged. The file is an XML file called LogConfiguration.xml, and should be created in %LOCALAPPDATA%\JetBrains\{HostFullIdentifier}\v{WaveVersion}.

When running the ReSharper Platform in an experimental instance of Visual Studio, the logging subsystem will also look for a file called LogConfiguration.Debug.xml, allowing for a separate configuration for debugging extensions in experimental instances. This file is looked for first, and if it doesn't exist, the LogConfiguration.xml file is used instead.

The best way to set up a log file is via the Logging Options Page which is only visible when in Internal Mode.

The file format is fairly straightforward:

The appender element defines an appender/listener, which is the class that will listen for events and output them.

  • name - the name attribute is required so the appender can be referenced later in the file.

  • class - the class attribute is the fully qualified type name of the appender class. The class must implement the ILogEventListener interface.

  • pattern - the pattern attribute (not shown) defines a pattern that can be used to define the output pattern for messages. See below for more details.

  • arg - the arg element is used to pass arguments to the constructor of the appender. Multiple child arg elements are allowed, and are passed as-is, as strings, to the appender. It is up to the appender to interpret the argument value. For example, the FileLogEventListener will substitute the current date in the value C:\logs\resharer-{date}.log.

The root element defines the logging level and appenders that apply for all categories, unless otherwise overridden. It is the default way of setting the logging details for the Platform.

  • level - this is the logging level, as text. See here for the list of logging levels.

  • appender-ref - the appender-ref child elements specify the name of the appenders that are to be used to log events. The appenders need to be created in appender elements at the head of the file.

The logger element defines the logging level and appenders to use for a category. When creating a logger, the code can specify a category, usually a namespace. This allows for logging to be configured differently for different parts of the Platform. For example, the JetBrains.Platform.Util category can be set to OFF to disable all logging from components in the JetBrains.Platform.Util namespace, or the JetBrains.DataFlow namespace can be configured to output to a different file, and capture events at a different logging level.

  • name - the name attribute is required to specify the category that is to be configured.

  • level - the level attribute allows overriding the root logging level.

  • additivity - the additivity attribute is a boolean value to control if previously declared appenders are also used for this category. The default value is true.

  • appender-ref - the appender-ref child elements can be used to specify one or more appenders that will be used to output the log events. More than one element can be specified. All appenders must be specified in appender elements at the head of the file.

The ReSharper Platform will pick up changes to the file automatically, without requiring a restart.