2025-06-12
Syntax highlight for .log files
Here’s a guide to making the .log files easier to scan in PhpStorm.
-
Go to Preferences > Editor > Log Highlighting
-
Add new Log format
- Name: Yii
- Message pattern:
^([\d-: ]+)\[(.*?)\]\[(.*?)\]\[(.*?)\]\[(.*?)\]\[(.*?)\] (.*) - Message start pattern:
^\d - Time format:
yyyy-MM-dd HH:mm:ss - Time capture group: 1
- Severity capture group: 5
- Category capture group: 4
-
Add Patterns
^\s*e(rror)?\s*$^\s*w(arn(ing))?\s*$^\s*i(nfo)?\s*$^\s*p(rofile.*)?\s*$^\s*d(ebug)?\s*$^\s*t(race)?\s*$
-
Then add colors you like for each pattern: Select colors and highlight options. Select "Highlight line" for errors and warnings to highlight the whole section instead of only the words.
-
Select "Highlight line" for errors and warnings to highlight the whole section.