Last active
June 12, 2023 18:55
-
-
Save masonwan/7956055 to your computer and use it in GitHub Desktop.
Print out Tomcat log file "catalina.out" with color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tail -200 catalina.out | ack-grep --flush --passthru --color --color-match=red "^.*ERROR.*" | ack-grep --flush --passthru --color --color-match=green "^.*DEBUG.*" |
Here are my contributions, based on @ElMesa's fork:
https://gist.github.com/tfga/26c22026d9aeb9c0df3db2b39ccfbf88
-
Refactored the code to use functions, so now the main code looks like this:
colorize red "ERROR" | \ colorize red "SEVERE" | \ colorize green "DEBUG" | \ colorize yellow "Deploying|finished" | \ colorize blue "INFO"
-
You can colorize the whole line or just "the word" / regex match (e.g.
ERROR
,SEVERE
). -
Made it a pipe:
catalina.sh run 2>&1 | colorizeTomcat tail -200 catalina.out | colorizeTomcat
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If u are interested i forked the gist and included the colors info with attribution included:
https://gist.github.com/ElMesa/374c556283972e96deef