Output a timestamp with each line in a Maven log

04 December, 2017

Maven is a powerful build tool for Java and it tends to spit out a large amount of logs, requiring you to scroll back in your output window or console to look at what’s happening. If you’re running it regularly, for example whilst building tests then it’s easy to scroll back slightly too far and look at the results from a previous run by accident.

An easy way to avoid this is to configure Maven to output a timestamp on each log line. Just open up your MAVEN_HOME/conf/logging/ and change the dateTimeFormat like this:


Not only will this make it easier to spot if you’re looking at the correct log lines but you’ll also be better able to see how long each stage is taking (although for real measurements here you’ll want a profiler).

See other posts tagged with general and all posts made in December 2017.