Hi everyone.

I'm using Maven to build my project and I'm stuck on the following problem:

I have a log4j.xml file with an appender configured like follows

    <appender name="audit-file"
class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File"
value="${jboss.server.log.dir}${file.separator}mte-imo-audit.log" />
        <param name="DatePattern" value="'-'yyyy-MM-dd'.log'" />
        <layout class="br.gov.dataprev.infra.audit.JsonLayout" />
    </appender>

This file is being filtered by Maven to switch some other user custom
variables in other parts of the log4j.xml configuration (not shown above
because it´s not relevant to the problem), but I did not want Maven to
switch the value of ${file.separator}, which is intended to be a variable
for use of jboss. Unfortunately, as it is a variable that Maven recognizes,
it´s trying to change its value on 'mvn package' command. That´s a problem
to me, because I´m building the package using a machine that runs on Windows
and deploying in a machine that runs on Linux.

I know I could make profiles to try to fix this, but my first intention of
using ${file.separator} is to have a file that can be put on any OS and the
solution of using Maven profiles would make me rebuild the entire package
just to replace the "file separator" character.

So, I would like to know if there is a way to configure Maven in such a way
that after the Maven filtering, the final log4j.xml keeps the string
${file.separator} untouched, without having it switched for "\" or "/".

Thanks in advance and sorry for eventual grammar and vocabulary mistakes, as
English is not my first language. I hope I made myself clear enough.

Reply via email to