Logfile highlighting

2014-06-17
2014-06-18
  • Dear community and Notepad++ authors.

    First of all my congrats for this excellent software. I love Notepad++ and use it daily for personal tasks plus in my work environment where I have to troubleshoot through traces and log files.

    In some cases I have to admit I double by using SynWrite text editor (much slower and capable in handling large text files) nevertheless has a very extensive list of syntax highlighting that fits the complexity of files I'm investigating with.

    Aside programming languages you can find options for batch files, ini files and most importantly for my needs logfiles.

    I wish this can be considered also for Notepad++ in the future.

    Thank you very much in advance for any considerations.

     
  • Loreia2
    Loreia2
    2014-06-18

    Hi Panagiotis,

    what is logfile format? I never heard of it. Can you share some links?

    Regards,
    Loreia

     
  • Sure...

    SynWrite can be accessed here:
    https://sourceforge.net/projects/synwrite/

    I attach here an export of the logfile lexer via text editor's Option menu > Customize lexer library. Some hints can be seen from viewing this file but of course it's not importable in Notepad++ in this format via 'User Defined Language', it will most probably have to be re-built manually.

    If you care to play around and install SynWrite, just view any random logfile and from the status bar at the bottom click (normally the Default value will show: Text files) and change the view from the appearing menu via L > Logfiles.

    Notepad++ doesn't have to follow this syntax highlighting in full. It will be just a good idea and starting point to have a more generic syntax highlighting for typical log entries (e.g. highlighting for words like error, failed, successful, returned, done etc).

    This will be eye-catching when investigating/viewing log files. I know that not every log file has the same syntax but it's a good start to cover typical wording here. I presume all logs independent of their individual syntax will report an error with words like error, failed/failure, refused, unable, disconnected, rejected, dropped and the like. You get the idea.. ;-)

     
    Attachments
  • Loreia2
    Loreia2
    2014-06-18

    Hi Panagiotis,

    I just installed SynWrite, and I see nothing special about its "Logfiles" lexer. Just few highlighted keywords. Here is what I was able to make in just few minutes with UDL. I even added folding.

    Import the file from UDL module (Language / Define your language...), and open Logfiles.lcf in Notepad++.

    Regards,
    Loreia

     
    Attachments
  • Well, probably it doesn't have to be too special to do its job and be helpful in the context of the use case I outlined before. Or maybe the sample logfile you used wasn't complex/long enough to appreciate the assistance at hand.

    Anyhow, I guess tastes differ. Cannot argue on that.

    I did import as you instructed the xml and Notepad++ reported the action successful.

    I'm not sure how do I choose now to display a log file using this as syntax highlighter. I don't see a new entry under Language menu but I presume this is by design.

    The 'User language' field has now in the drop down list a new option called Logfiles but I'm not sure what to do next.

    Thanks!

     
  • Loreia2
    Loreia2
    2014-06-18

    Hi Panagiotis,

    try to restart Notepad++, then you should see new entry in Language menu. Also, it should automatically apply highlighting on files with .lcf extension.

    Well, probably it doesn't have to be too special to do its job and be helpful in the context of the use case I outlined before. Or maybe the sample logfile you used wasn't complex/long enough to appreciate the assistance at hand.

    I simply meant to say that most of that stuff is already available in Notepad++.

    Regards,
    Loreia

     
  • Hi Loreia,

    I see the option now after restart, thanks.
    It doesn't do any highlighting though.

    But let's put this aside for a minute and focus on similar functionality in Notepad++.

    Which Language do you suggest for highlighting log files?
    I don't expect of course Notepad++ to mirror SynWrite here. I find Notepad++ more reliable anyway as I already noted. I only double with SynWrite to easily catch important references in log files while viewing like errors and the like.

    Any adequate alternative here should suffice I presume but all listed highlighters in Notepad++ have to deal primarily with programming languages where for example the word 'error' is of no special meaning thus not treated in a special manner.