Tuesday, August 10, 2010

controlling logback configuration in standalone app

Application end-users must have the ability to change the logback logging level applied to all of the DK code, without having to explode the application jar.

Logback looks for a config file named logback.xml on the classpath. So first we copy a new logback.xml file into cwd and try setting the classpath on the command line:

java -cp . -jar diffkit-app.jar

No joy.

But this works: 

java -Dlogback.configurationFile=./logback.xml -jar diffkit-app.jar
Simple enough.

Also, logback can find the logback.xml file embedded in the application jar if the System property is defined this way:

java -Dlogback.configurationFile=conf/logback.xml -jar diffkit-app.jar

In this case, logback treats the property value as a classpath resource specification.


  1. There are lots of information about latest technology and how to get trained in them, like Oracle Training in Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(Oracle Course in Chennai). By the way you are running a great blog. Thanks for sharing this.

    1. Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training

      Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Java Online Training Java Online Training Java Online Training Java Online Training

    2. Java Training Institutes Java Training Institutes Java EE Training in Chennai Java EE Training in Chennai Java Spring Hibernate Training Institutes in Chennai J2EE Training Institutes in Chennai J2EE Training Institutes in Chennai Core Java Training Institutes in Chennai Core Java Training Institutes in Chennai

  2. Your blog is awesome..You have clearly aboutcontrolling logback configuration in standalone app...Its very useful for me to know about new things..Keep on blogging..
    Java training in chennai

  3. Very nice post. Thanks for sharing such a useful post.

    wordpress Training in Chennai

  4. hi..really you have post an informative blog.it will be really helpful to many peoples.
    apachespark training

  5. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

  6. There are so many useful information in your post, I like it all the time. And I want to share this improve app store ranking with you,you can take a look. This is very useful.

  7. Thanks to shared this informative details with us. Keep updating.

    DBA course syllabus | DBA training courses

  8. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.

    Java Training in Bangalore