log viewing

What I tried

  1. Logview mode emacs

  2. Notepad++

    Notepad++ supports ‘User Defined Languages’ for key word highlighting, folding etc..

  3. Wrote a log search gui in tkinter

    Tried this first , until I discovered notepad++ has all of the features I added built into it.

How I wanted to go about it

  • Regular expression for the tokens and parsing for the log format Turns out you don’t need that level of configuration See 1 timestamp tz LEVEL message etc..

Sample log file

com.org.class   2022-12-01 12:06:34 CET   INFO     Messages being logged to file: file.log                                                           methodname
com.org.class   2022-12-01 12:06:34 CET   INFO     something happened .                                                                                                                                                                             methodname
com.org.class   2022-12-01 12:06:44 CET   INFO                                                                                                                                                                                                               methodname
com.org.class   2022-12-01 12:06:44 CET   INFO     Processed in 10 secs.                                                                                                                                                                                     methodname
com.org.class   2022-12-01 12:06:44 CET   INFO                                                                                                                                                                                                               methodname
com.org.class   2022-12-01 12:06:44 CET   INFO     Completed------------------------------                                                                                                                                                                   methodname

Features I wanted

  1. Highlighting

    In Notepad++ ‘User defined language’ can be configured for keywords highlighting.

    Logview mode in emacs has better highlighting with simple configuration.

    '(datetime-timezone 'Asia/Kolkata)
    '(logview-additional-submodes
      '(("MYLOGS"
         (format . "NAME TIMESTAMP IGNORED LEVEL MESSAGE")
         (levels . "JUL")
         (timestamp)
         (aliases))))
    
  2. Filtering based on the different fields

    In Notepad++ the standard search interface is decent, but not as flexible as logview-mode.

    Logview mode in emacs has keybindings and functions to filter by each of the above fields (Message , level etc..).

  3. Folding

    Notepad++ folds can be defined for START and END keywords for a User definied language.

    Still trying to figure out folding in emacs. Although hideshow does a decent job, it doesn’t have the ‘fringe’ [+] [-] to expand and collapse.

  4. Tailing Logs

    Notepad++ has a ‘monitoring mode’ which is built in, but this doesn’t seem to work for me, likely because logs are on a network drive.

    Emacs has auto-revert-tail-mode but has the same issue.