Maven is using SLF4J for its logging. Its default binding is an extended simple logger flavor of SLF4J, which means it can be configured using simplelogger.properties file (in Maven conf/logging directory) or using system properties.
To add timestamps to log output we need two properties:
org.slf4j.simplelogger.showDateTime
: a boolean to add the timestamp in the outputorg.slf4j.Simplelogger.dateTimeFormat
: a SimpleDateFormat which formats the timestamp activated by previous property
We can do it permamently in the simplelogger.properties file or add these system properties on the JVM, possibly using MAVEN_OPTS
-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS
-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS -Dorg.slf4j.simpleLogger.showThreadName=true
showThreadName also work