How can I get Tomcat's logging.properties to recognize my Catalina variables? -
we have several tomcat 7
instances installed on different servers. deploy same app different tomcats (for different customers) differences being configs. in effort standardize logging locations, etc., trying make apps "universal" deploying war file tomcat instance wire automatically don't have remember change app customer 1 , again customer 2, etc.
anyway, in each tomcat/conf
folder, have added properties end of catalina.properties
file. example:
# custom logging log.base=c:/logs/tomcat/myapp log.file=myapp.log
now, in application's log4j.cfg
file, have:
log4j.appender.r.file=${log.base}/${log.file}
and in application's myapp.cfg
have:
logfile=${log.file}
works great when deploy. tomcat puts should except what's in logging.properties
file.
that file contains:
1catalina.org.apache.juli.filehandler.directory = ${catalina.base}/logs 2localhost.org.apache.juli.filehandler.directory = ${catalina.base}/logs 3manager.org.apache.juli.filehandler.directory = ${catalina.base}/logs 4host-manager.org.apache.juli.filehandler.directory = ${catalina.base}/logs
but want change ${catalina.base}/logs
use own ${log.base}
variable. tomcat (or perhaps log4j?) doesn't recognize this. instead, creates directory named "${log.base}" in tomcat root folder.
i read can declare custom variables in setenv.bat
file. did , still didn't work.
how can fix this?
btw, using windows, tomcat 7 , windows service install (with gui).
thanks
set environment variable java_opts in setenv.bat. in way give java vm argument. following works in setenv.sh in linux:
export java_opts="-dlog.base=/logs/tomcat/"
now should able use ${log.base} in logging.properties
Comments
Post a Comment