Turn Notepad++ into a log file analyzer

It’s always a pain to analyze log files using a text editor. The good news is that Notepad++ supports user-defined languages natively, without the need to install any plugin. I wrote a custom syntax highlighter that turns Notepad++ into a basic log viewer..

Here’s how to configure and enable the highlighter:

  • Create text file and name it LOG.XML   (extension need to be xml)
  • Paste the below code in this xml file and save it
<NotepadPlus>
    <UserLang name="WS1-Logs" ext="WS1-Logs">
        <Settings>
            <Global caseIgnored="yes" />
            <TreatAsSymbol comment="no" commentLine="no" />
            <Prefix words1="no" words2="no" words3="no" words4="no" />
        </Settings>
        <KeywordLists>
             <Keywords name="Comments">00 01 02 03 04</Keywords>
            <Keywords name="Operators1">- . , : ; ( ) [ ] =</Keywords>
            <Keywords name="Keywords1">ERROR FATAL</Keywords>
            <Keywords name="Keywords2">DEBUG</Keywords>
            <Keywords name="Keywords3">INFO</Keywords>
            <Keywords name="Keywords4">WARN</Keywords>
	    <Keywords name="Keywords5">google apple android fail accesss denied fail unreachable</Keywords>
            <Keywords name="Delimiters">00&quot; 01 02&quot; 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
          <WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="FFFFFF" colorStyle="0" fontName="Courier New" fontStyle="0" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="007500" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="FFFFFF" bgColor="FF0000" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="FFFFFF" bgColor="0080FF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="00FF00" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="FFFFFF" bgColor="FF8000" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFF00" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="888888" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>
  • Click Language → User Defined Language →Define your language → Import
  • Select the LOG.XML file.
  • Restart the application.
  • Click Language  , scroll down and select WS1-Logs

Leave a Reply

Your email address will not be published. Required fields are marked *