Skip to content

Instantly share code, notes, and snippets.

@gkhays
Last active January 29, 2020 20:33
Show Gist options
  • Save gkhays/3e082e8e3482bcc5239f904dea57d4cb to your computer and use it in GitHub Desktop.
Save gkhays/3e082e8e3482bcc5239f904dea57d4cb to your computer and use it in GitHub Desktop.

Getting Debug Logging with Maven and Cargo

Starting in Maven 3.1.x, logging was switched to SLF4J. The consequence is that you no longer receive DEBUG or TRACE logging messages in a cargo build.

Modify Simple Logger Properties

You can update ${MAVEN_HOME}/conf/logging/simplelogger.properties. But that will create a lot of "noise."

org.slf4j.simpleLogger.defaultLogLevel=DEBUG

Instead, add the following entry to simplelogger.properties.

org.slf4j.simpleLogger.log.org.codehaus.cargo.maven2.ContainerRunMojo=debug

Maven User Settings

Alternatively, you can create .mvn/jvm.config. E.g.

cat ~/.mvn/jvm.config
-Dorg.slf4j.simpleLogger.log.org.codehaus.cargo.maven2.ContainerRunMojo=debug

Note: You may also set the logging level to trace.

SLF4J Simple Defaults

org.slf4j.simpleLogger.defaultLogLevel=info
org.slf4j.simpleLogger.showDateTime=false
org.slf4j.simpleLogger.showThreadName=false
org.slf4j.simpleLogger.showLogName=false
org.slf4j.simpleLogger.logFile=System.out
org.slf4j.simpleLogger.cacheOutputStream=true
org.slf4j.simpleLogger.levelInBrackets=true
org.slf4j.simpleLogger.log.Sisu=info
org.slf4j.simpleLogger.warnLevelString=WARNING

# MNG-6181: mvn -X also prints all debug logging from HttpClient
# Be aware that the shaded packages are used
# org.apache.http -> org.apache.maven.wagon.providers.http.httpclient
org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=off
org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient.wire=off

References

  1. How to change maven logging level to display only warning and errors?
  2. Maven and properties for slf4j simplelogger
  3. Maven logging and the command line
  4. Maven 3.1.x logging
  5. Maven - simplelogger.properties (GitHub)
  6. Configuring Apache Maven
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment