I usually use tomcat plugin in eclipse and run it from eclipse.开发者_开发百科 Now I want to use it from terminal. but the problem is I dont get the output in colors. Atleast the errors should be displayed in red .
Any idea how to achieve this ?
EDIT: If no such tool exists, can anyone guide me to create one. I am interested to create one such tool.
yes there is a way actually, first you need to make apache tomcat log using log4j instead of the default logger. Then you can actually customize the output for log4j. You are going to have to read a bit on logging for tomcat, and about log4j, you can have console output configured and then you can have what ever colors you need in them since they are customizable.
Some links that will help you .
http://tomcat.apache.org/tomcat-6.0-doc/logging.html
http://marc.info/?l=log4j-user&m=120574713010072
Try this class written by Dan Dyer.
You can try ccze , but still not perfect work with less or tail, works well with static log
Turn on grep
's line buffering mode.
Using tail
tail -f fileName | grep --line-buffered my_pattern
Using less
less +F fileName | grep --line-buffered my_pattern
Using watch & tail to highlight new lines
watch -d tail fileName
- For linux based systems.
精彩评论