Search code examples
javalog4j2vert.x

How to set different logging levels for vertx shadow jar in runtime?


vertx starter use shadow jar plugin to package a fat-jar

log4j2.xml will be put into the jar file

How can I run the jar with different log levels? (With springboot I can set -Dspring.profile.active=test to use application-test.yml for switch on debug logging)


Solution

  • You can make Log4j2 use another configuration file by setting the log4j2.configurationFile system property, as explained in the configuration section of the documentation:

    java -Dlog4j2.configurationFile=/path/to/log4j2.xml -jar myapp.jar