[logback-user] using "default" logback.properties and "override" logback.properties in logback.xml

Gena Makhomed gmm at csdoc.com
Sat Dec 8 18:50:41 CET 2012


Hello, All!

is it possible with logback create "default" properties file
with default settings, which can be overwritten in extra config?

for example:

/opt/tomcat/webapps/app/WEB-INF/classes/logback.xml
/opt/tomcat/webapps/app/WEB-INF/classes/logback.properties
- "default" (read only) properties, deployed from war-file

/opt/tomcat/webapps.config/app/logback.properties
- local "override" properties with same names as in "default" config.

for example, in "default" logback.properties:
log.level.spring = INFO
log.flush = true
log.rotate = 9
log.size = 1MB

in "override" logback.properties:
log.level.spring = DEBUG

and logback.xml in this case will use
${log.level.spring} from "override" config.

if "override" config not exists, or this property in "override"
config not exists - then use "default" value from default config,
for example, for ${log.size} or ${log.rotate}

with Spring Framework this is possible, AFAIK/AFAIU.
it will be very useful configure logback in same way.

I am try many variants in logback.xml:

<property 
resource="${catalina.base}/webapps.config/app/logback.properties" />
<property resource="logback.properties" />

<property resource="logback.properties" />
<property 
resource="${catalina.base}/webapps.config/app/logback.properties" />

and so on, but nothing works. can you help me?
or this is not possible with logback at all?..

-- 
Best regards,
  Gena


More information about the Logback-user mailing list