cBioPortal / icebox

very low priority issues
0 stars 0 forks source link

Bad Maven filtering in log4j.properties #26

Open morungos opened 8 years ago

morungos commented 8 years ago

I've just seen a problem building a Debian package for cBioPortal. I'm using jdeb, so I'm packaging on a different system to deployment. The problem is in the log4j.properties file, which contains the following:

log4j.appender.a.rollingPolicy.FileNamePattern = ${java.io.tmpdir}/cbioportal.log.%d.gz
log4j.appender.a.File = ${java.io.tmpdir}/cbioportal.log

These are being termplated by Maven, so the file embedded in the war reads:

log4j.appender.a.rollingPolicy.FileNamePattern = /var/folders/hd/7k7vfhcj1qd08_0l28qyhmmh0000gn/T//cbioportal.log.%d.gz
log4j.appender.a.File = /var/folders/hd/7k7vfhcj1qd08_0l28qyhmmh0000gn/T//cbioportal.log

The location should not be hardwired inside the application. There are many ways to solve this, ranging from wiring the logger to some container-provided log, to environment variables.

morungos commented 8 years ago

See: http://stackoverflow.com/questions/13066042/how-to-give-environmental-variable-path-for-file-appender-in-configuration-file

morungos commented 8 years ago

Unlike the Maven documents imply, maven-resources-plugin does filter property files by default, or seems to. When I added <filtering>false</filtering> to business/pom.xml the log4j is intact, and then the variables will get substituted later. However, they still point to a funny place for a log.