For better readability and navigation, PhpStorm highlights different elements of .log files that are opened in the IDE's editor or terminal.
Log highlighting is based on the configurable log formats and coloring patterns. Highlighting of Laravel, Symfony, and WordPress log files is pre-configured and supported in PhpStorm by default. You can customize the pre-configured log formats and highlighting patterns, or add new ones in Settings Ctrl+Alt+S | Editor | Log Highlighting.
Item
Description
Display heatmap on the error stripe/scrollbar
Unselect the checkbox to disable log highlighting heatmap on the scrollbar.
Highlight links and code references in logs
Unselect the checkbox to disable highlighting of links and code references in log files.
Allow editing log files smaller than (KB)
Specify the minimum size of editable log files in KB.
Import
Click the button to import an existing .xml file with log formatting settings.
Export
The button is displayed only after you select at least one item from the Log Formats, Message pattern, or Filters tables below.
Click to export the selected log highlighting settings in the .xml format.
Reset Selection
The button is displayed only after you select at least one item from the Log Formats, Message pattern, or Filters tables below.
Click to reset the selection.
Log Formats
In this section, you can add custom log formats or edit/delete the pre-configured ones.
To add a new log format, click , enter a name for the new log format, and specify:
Message pattern: a regular expression defining how to parse logging messages in a log file. It should include capture groups for time, severity, category, and message. If the log format doesn't have any of these, it's safe to omit them.
Message start pattern: a regular expression defining lines on which logging messages in a log file start.
Make sure to begin your pattern with ^ to ensure proper matching of multiline messages.
Time format: the date and time format used in the current log format.
Time capture group, Severity capture group, Category capture group: the capture group indices for time, severity and category. Capture groups are numbered starting with 1. If you don't have a capture group for an item, specify 0.
Apply message pattern to all message lines: select the checkbox to apply the message pattern to every line of multiline messages. When the checkbox is not selected, the pattern is applied only to the first line of the message, and all the subsequent lines are considered to be part of this message.
With logs that have lots of multiline messages, leaving this checkbox unselected helps significantly improve performance.
Patterns
In this section, you can add custom highlighting patterns or edit/delete the pre-configured ones. Highlighting patterns are applied to the capture groups specified in the Log Format section. Each highlighting pattern consists of a regular expression pattern and the coloring action which is applied if the text matches the pattern.
To edit an existing pattern, select the respective row in the table and click on the section toolbar. In the dialog that opens, specify:
Action: select one of the available highlighting actions from the drop-down list:
Highlight line — highlights the whole message with the configured style.
Highlight field — highlights the field (capture group) where the match occurred.
Highlight match — highlights just the matched text.
Log format: from the drop-down list, select either a specific log format, or Any to apply the pattern to all created log formats.
Capture group: the capture group index for the regular expression defined in the Pattern field.
Bold: select the checkbox to highlight the defined log scope in bold.
Italic: select the checkbox to highlight the defined log scope in italic.
Foreground: select the checkbox and click on the value field to the right from it to open the Choose Color dialog and specify the foreground color.
Background: select the checkbox and click on the value field to the right from it to open the Choose Color dialog and specify the background color.
Show on stripe: select the checkbox to display marks for the detected pattern occurrences on the scrollbar.