logging - how do I suppress a inherited projects logback.xml file (2 logback.xml in a single project)? -


i have project com.samedhi/base has logback.xml file , project com.samedhi/derive has logback.xml file. project 'derive' has dependency on 'base'. when "lein trampoline repl" on 'derive', following warning.

.... 15:34:30,066 |-info in ch.qos.logback.classic.loggercontext[default] - not find resource [logback.groovy] 15:34:30,066 |-info in ch.qos.logback.classic.loggercontext[default] - not find resource [logback-test.xml] 15:34:30,066 |-info in ch.qos.logback.classic.loggercontext[default] - found resource [logback.xml] @ [file:/home/stephen/work/com.samedhi/derive/client/config/logback.xml] 15:34:30,067 |-warn in ch.qos.logback.classic.loggercontext[default] - resource [logback.xml] occurs multiple times on classpath. 15:34:30,067 |-warn in ch.qos.logback.classic.loggercontext[default] - resource [logback.xml] occurs @ [jar:file:/home/stephen/.m2/repository/com/samedhi/base.app/0.0.1-snapshot/base.app-0.0.1-snapshot.jar!/logback.xml] 15:34:30,067 |-warn in ch.qos.logback.classic.loggercontext[default] - resource [logback.xml] occurs @ [file:/home/stephen/work/com.samedhi/derive/client/config/logback.xml] 15:34:30,129 |-info in ch.qos.logback.classic.joran.action.configurationaction - debug attribute not set .... 

so, problem appears have 2 logback.xml's in classpath. supposed "surpress" logback.xml project 'base' when lein repl 'derive' project?

as far i'm concerned, should never package logging config file (logback.xml, log4j.properties, or have you) inside jar file. whole point of having logging config file make easy end-user adjust logging levels editing file. burying in archive defeats purpose of that, because change logging level user has expand archive, edit file, , re-package archive.

here's preferred layout deployed application. it's little bit more work set up, imo worth trouble because gives flexibility , ease of configuration uberjar doesn't.

my-app/   bin/     run-app.sh   config/     logback.xml   lib/     my-lib.jar     my-app.jar 

your run-app.sh script like:

bin=`dirname "$0"` base=$bin/.. java -cp "$base/config:$base/lib/*" my-app.main 

this has advantage that, putting config directory @ front of classpath, logging config file found there should take precedence on might found in 1 of jars (e.g. included third-party library have no control over).


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -