How to avoid modifying logback.xml in different environments?

Hi My logback.xml contains the following RollingFileAppender configuration: <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>/usr/share/tomcat5/logs/Dummy.log</File> <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>Dummy.%d.log</FileNamePattern> <MaxHistory>120</MaxHistory> </RollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> </layout> </appender> The log file is created in /usr/share/tomcat5/logs, which is on the production Unix server. The problem is my development environment is on Windows, and Tomcat in a different directory, so I have to modify the directory every time before I deployed the application to the production server. Is there a convenient way that I don't have to modify logback.xml, and share the same logback.xml in different environments? Thank you! -- Hez

See Variable substitution Ralph On Aug 24, 2009, at 10:38 PM, hezjing wrote:
Hi
My logback.xml contains the following RollingFileAppender configuration:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>/usr/share/tomcat5/logs/Dummy.log</File> <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>Dummy.%d.log</FileNamePattern> <MaxHistory>120</MaxHistory> </RollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</ Pattern> </layout> </appender>
The log file is created in /usr/share/tomcat5/logs, which is on the production Unix server.
The problem is my development environment is on Windows, and Tomcat in a different directory, so I have to modify the directory every time before I deployed the application to the production server.
Is there a convenient way that I don't have to modify logback.xml, and share the same logback.xml in different environments?
Thank you!
--
Hez _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

In the link provided by Ralph the # character was replaced by %23, the correct link is: http://logback.qos.ch/manual/joran.html#variableSubstitution Cheers, Ralph Goers wrote:
See Variable substitution <http://logback.qos.ch/manual/joran.html%23variableSubstitution>
Ralph
<http://logback.qos.ch/manual/joran.html%23variableSubstitution>On Aug 24, 2009, at 10:38 PM, hezjing wrote:
Hi
My logback.xml contains the following RollingFileAppender configuration:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>/usr/share/tomcat5/logs/Dummy.log</File> <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>Dummy.%d.log</FileNamePattern> <MaxHistory>120</MaxHistory> </RollingPolicy> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern> </layout> </appender>
The log file is created in /usr/share/tomcat5/logs, which is on the production Unix server.
The problem is my development environment is on Windows, and Tomcat in a different directory, so I have to modify the directory every time before I deployed the application to the production server.
Is there a convenient way that I don't have to modify logback.xml, and share the same logback.xml in different environments?
Thank you!
--
Hez _______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://qos.ch/mailman/listinfo/logback-user
------------------------------------------------------------------------
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch
participants (3)
-
Ceki Gulcu
-
hezjing
-
Ralph Goers