Viewing, filtering and navigation for log files in Rider 2018.1 EAP

Posted on by Maarten Balliauw

Our latest Rider 2018.1 EAP build comes with support for the Ideolog plugin. The what now? Well, the Ideolog plugin is a rich viewer for .log files that adds highlighting based on log level and other properties, folding for log fields in the IDE and much more. Let’s take a look at how this nifty tool can help you work with your log files!

Installing the Ideolog plugin

In case you missed the featured plugins that Rider suggests installing the first time you run the product, we’ve recently added the Ideolog plugin to the list. No worries if you did miss it: we can always add it from the settings. Under PluginsInstall JetBrains plugin…, we can install Ideolog:

Installing the Ideolog plugin in Rider

One restart of the IDE later, we’re ready to go!

Highlighting log files based on log verbosity and other columns

Once installed, the Ideolog plugin is active for any .log file. If you’d like to enable the plugin for other file extensions, open the settings under Editor | File Types, then under Recognized File Types | Log, add any additional patterns for which you want to enable Ideolog functionality.

Rider will open log files in read-only mode if they are larger than 16KB. Depending on the structure of the log file, it may already provide default highlighting based on log verbosity, and display a heatmap in the scrollbar – making it easier to spot warnings and errors in a sea of verbose or informational events. For example here is Rider’s own backend.log where we can see Verbose logs in the default editor color, Warnings displayed in orange, and Informational messages in green. Error messages would be shown in red.

Highlighting based on log verbosity

Rider recognizes our log file contains several fields. We can use Alt+Enter anywhere in the log file to show/hide certain values. For example if we are only interested in warnings, we can tell Rider to only show lines with “W” in this field:

Show only lines that are warnings

The Ideolog plugin provides several options to show/hide or highlight lines in our log file:

  • Hide lines above/below – Folds all log lines above/below the cursor. This is a useful one when interested in the tail of a log file: we can pick the last few lines in our log, hiding messages we are not interested in.
  • Show/Hide lines containing value – Shows/Hides lines containing a given value. This one is especially handy when searching for log messages for a specific record in the database. For example we could only show lines containing primary key customer123.
  • Show/Hide lines with value in this field – Similar to the previous one, except Rider will filter based on values in the current field.
  • Highlight value – Instead of folding messages, this will simply colorize lines with a given value.
  • Highlight this column – Highlights the current column and renders a different color for each distinct value.
  • Show only lines containing value – Folds lines that do not contain a given value.
  • Show only lines with value in this field – Folds lines that do not contain the given value in the current field.

Working with time values

Based on configured log formats, Rider will try to determine the time series in our log files when parsing them. Using Alt+Enter and then Toggle time highlighting, we can highlight the time field in our log. Highlighting is based on time since the previous event, making it a great help to detect freezes and other discrepancies.

Time series highlighting in Rider log files with Ideolog

Exceptions, exceptions everywhere!

A common practice is to write Exception details to the log. They happen, so as developers we might as well make use of the information they can provide. For example, we can log the exception message and stack trace.

When such message is encountered in a log file, Ideolog will provide highlighting for the exception, including syntax highlighting for file names, types and methods in the stack trace. And we also get navigation! For example we can Ctrl+click on the file name and line number where the exception occurred to navigate there at once:

Navigate to exception stack trace in Ideolog

Configuring log format and highlighting

By default, the Ideolog plugin recognizes three log formats: pipe-separated, much like the Rider backend logs you can find from the Help | Show Log in Explorer menu, IDEA-style logs, and TeamCity build logs. Rider will try parsing the first 25 lines of the log file to determine the format to use.

Custom formats can be defined from the settings under Editor | Log Highlighting. We can also define highlighting patterns here:

Custom log format and patterns for highlighting

We can add custom log formats here, by adding two Java regular expression and a time format, which then translates into the different field types present in our logs:

Pipe-separated format definition

Highlighting can also be extended based on a Java regular expression. Any highlighting we define can either highlight the full line, the current field, or just the match that was found.

If you’re interested in contributing to the Ideolog plugin or just want to look through the sources to see how it works, we invite you to have a look at the Ideolog GitHub project.

Give the latest Rider 2018.1 EAP build a try! We’d love to hear your feedback!

Comments below can no longer be edited.

1 Response to Viewing, filtering and navigation for log files in Rider 2018.1 EAP

  1. Dani Vainshenker says:

    July 14, 2018

    Love your work with RIder and Resharper!

    Working a lot with NLOG/Serilog like many other developers.

    The LOG plugin is blessed! Can;t find a GOOD desktop log viewers.

    Can you add recognition of NLOG and Serilog patterns…


Subscribe to .NET Tools updates