March 21, 2015

How to make Java Less Chatty

When I program, I like to have the logging up to the max. Others don't. The shell pipe below filters the logging messages out, leaving only the run output, output first:

% java -jar foo.jar

  .   ____          _            __ _ _g,
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.2.1.RELEASE)

Sending a new message.
Received  success!
And the magic incantation to remove all the extraneous messages is: mvn spring-boot:run | grep -v "`date +'%Y-%m-%d %H:%M'`" | grep -v '^\['; I do hope that makes your getting on with peers a lot easier.

No comments:

Post a Comment