Skip to content

Instantly share code, notes, and snippets.

@kmila
Last active December 13, 2015 23:19
Show Gist options
  • Save kmila/4991312 to your computer and use it in GitHub Desktop.
Save kmila/4991312 to your computer and use it in GitHub Desktop.
nanorc for log4j
#.nanorc
# logging syntax highlighting
#
# * initially based on log-stuff.nanorc (github.com/mattpowell/.nanorc), changed completely to adapt to log4j.
syntax "logs" "\.*(out|err|log|tdump|hprof)\.*$"
# markers and keywords
color brightwhite "[[:punct:]]"
color brightwhite start="(\[|<|\{|\()" end="(\]|>|\}|\))"
color brightblack "(\[|\{|\(|<|\]|\}|\)|>)"
color green "([[:space:]]|[[:punct:]])+(Start|start|START|Stop|STOP|END|End|end|ready|Ready|READY|pause|PAUSE|Pause|init|Init|INIT|publish|deploy|Thread|thread|THREAD|SQL|OK|ok|Ok|POST|GET|HTTP|http|localhost)"
color green "([[:digit:]][[:blank:]]|[[:digit:]])(d|h|m|s|ms|ns|null)[[:punct:]]?"
color brightwhite "([[:punct:]]|x)[[:xdigit:]]+)"
# date and time (yyyy-MM-dd?HH:mm:ss.SSS?)
color black,blue "[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]][02468]"
color black,cyan "[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]][13579]"
color white "[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}\.[[:digit:]]{3}"
color brightblack "\.[[:digit:]]{3}"
# log level
color black,white "(DEBUG|ERROR|FATAL|INFO|TRACE|WARN)"
# warning, errors
color brightyellow "(WARN|warn|Warn|unknown|Unknown|UNKNOWN|Timeout|TIMEOUT|timeout|Cancel|CANCEL|cancel|Finish|finish|FINISH|Unable|unable|Invalid|INVALID|invalid|Illegal|ILLEGAL|illegal|lock|LOCK|Lock)"
color brightred "(ERROR|Error|err|Exception|Wait|wait|WAIT|deadlock|Deadlock|DEADLOCK|SEVERE|Severe|FATAL|Fatal|Terminate|terminate|kill|Kill|fail|FAIL|Fail)"
# stacks
color brightmagenta start="(Exception in|Caused by)" end="[[:blank:]]"
color magenta start="[[:space:]]+at" end="[[:space:]]+"
color magenta "\(.*:[[:digit:]]+\)"
# higher priority keywords
color brightmagenta start="(thread|Thread|pool|Pool|POOL|THREAD)" end="([[:digit:]]|[[:punct:]]|[[:blank:]])"
color brightyellow "(<-|->|\|)"
color red,white "[^[:print:]]"
color brightblack "@[[:alnum:]]{1,8}[[:blank:]]"
color brightwhite,red "java\..*Error"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment