UDL Documentation and how to define a Language to highlight Log files



  • Hi All,

    I’ve been reading what documentation I can find with regard the the UDL, however, this doesn’t really show me what I want

    http://docs.notepad-plus-plus.org/index.php/User_Defined_Languages
    http://udl20.weebly.com/

    I don’t really want to define a syntax highlighting for a programming language, but rather to highlight lines were some text in the line matches a keyword in some log files, for example:

    • 2016-03-10T08:18:27.415+00:00 node 2016-03-10 08:18:27,415 Level=“ERROR” Name=“administrator.system.connectivity” Message=“Connectivity lost to node.”
    • 2016-03-10T08:19:40.825+00:00 node 2016-03-10 08:19:40,825 Level=“WARNING” Name=“administrator.system.configuration” Message=“Conferencing node appears unavailable.”
    • 2016-03-10T08:21:03.755+00:00 node 2016-03-10 08:21:03,755 Level=“INFO” Name=“administrator.gatewayroutingrulematcher” Message=“Alias matched gateway rule”

    The log entries have Keywords within them call “ERROR”, “WARNING” and “INFO”, but try as I might, I cannot seem to get the lines to automatically highlight. I also have tried to install a previously created Language called “Log4Net” from http://docs.notepad-plus-plus.org/index.php/User_Defined_Language_Files, and whilst this has define similar keywords, this too fails.

    Basically, I’m looking to see if I can get the line to stand out, i.e. Red text on yellow background for an Error, etc.

    How on earth can I achieve this?

    Cheers



  • Hello @Chris-Swinney,

    I’m not sure if you can do this with UDL properly as it is designed to act on words rather than lines.
    If it is sufficient then define the keywords ERROR, WARNING with the foreground and background color
    of your choice and define a double quote delimiter for open and close. Press style and allow nesting
    with your keywords.

    If this isn’t what you are looking for, then the other alternative I now would be using a python script
    to color the the lines.

    Cheers
    Claudia


Log in to reply