How can I configure logging for maven build? The log which maven generates is not providing enought information like time stamp with each log statement. Where/what log config file maven uses?
home}/conf/logging/simplelogger. properties file.
Maven configuration occurs at 3 levels: Project - most static configuration occurs in pom. xml. Installation - this is configuration added once for a Maven installation. User - this is configuration specific to a particular user.
MvnDebug. The Maven CLI comes prepackaged with an additional command that allows you to hook into executions with a debugger: mvnDebug . You can replace any mvn command with mvnDebug , and the command will immediately be queued up to execute once a debug listener hooks into it at the correct port.
You may be aware of this, and it will not print dates, but use mvn -X
to print verbose output.
Additionally, you can always pipe the output of maven to some other utility (assuming your shell environment contains halfway competent tools). For instance mvn -X clean | awk '{print "("d")"$0}' "d=$(date)"
prints out a date before each line in maven. I didn't bother formatting the date, but that's easily done with arguments to the date
executable. Note that this won't really work for maven commands that require interactive user input, such as maven archetype:generate
.
Answer provided by @whaley is a good direction. However, the $(date) is evaluated only once at the beginning and then remains the same. I had to use an approach mentioned in Is there a Unix utility to prepend timestamps to stdin?:
mvn -X <goals> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With