You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Artur Burnos (JIRA)" <ji...@apache.org> on 2014/10/10 12:53:33 UTC
[jira] [Updated] (LOG4J2-872) Property substitution works
incorrectly for filePattern in RollingFile appender
[ https://issues.apache.org/jira/browse/LOG4J2-872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Artur Burnos updated LOG4J2-872:
--------------------------------
Description:
I am trying to configure RollingFile appender in tomcat 7.0.23 with log4j2(2.0.2) with 10 log files.
I am using in the filePattern the ${sys:catalina.base}, it doesn't work and log files are placed in tomcat/bin/${sys:catalina.base}/ directory.
The interesting part is that the first log file (without a number) is created ok, under tomcat/logs - which means it succeeds to map the filename attribute to a real path.
When I replace ${sys:catalina.base} with filePattern="C:/apache-tomcat-7.0.23/logs/app.%i.log" it works.
Meaning that the filePattern is not interpreted properly.
was:
I am trying to configure RollingFile appender in tomcat 7.0.23 with log4j2(2.0.2) with 10 log files.
I am using in the filePattern the ${sys:catalina.base}, it doesn't work and log files are placed in tomcat/bin/${sys:catalina.base}/ directory.
The interesting part is that the first log file (without a number) is created ok, under tomcat/logs - which means it succeeds to map the filename attribute to a real path.
When I replace ${sys:catalina.base} with filePattern="C:/apache-tomcat-7.0.23/logs/app.%i.log" it works.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%X{REQ_ID}] [%c{1}] %m%n"/>
</Console>
<RollingFile name="FILE" fileName="${sys:catalina.base}/logs/app.log"
filePattern="${sys:catalina.base}/logs/app.%i.log">
<PatternLayout pattern="%d %-5p [%X{REQ_ID}] [%c{1}] %m%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</Root>
</Loggers>
</Configuration>
Meaning that the filePattern is not interpreted properly.
How do I overcome this without having to specify the log directory statically?
> Property substitution works incorrectly for filePattern in RollingFile appender
> -------------------------------------------------------------------------------
>
> Key: LOG4J2-872
> URL: https://issues.apache.org/jira/browse/LOG4J2-872
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.0.2
> Environment: Win 7 64, Tomcat 7.0.23, Log4j2 2.0.2
> Reporter: Artur Burnos
> Priority: Minor
>
> I am trying to configure RollingFile appender in tomcat 7.0.23 with log4j2(2.0.2) with 10 log files.
> I am using in the filePattern the ${sys:catalina.base}, it doesn't work and log files are placed in tomcat/bin/${sys:catalina.base}/ directory.
> The interesting part is that the first log file (without a number) is created ok, under tomcat/logs - which means it succeeds to map the filename attribute to a real path.
> When I replace ${sys:catalina.base} with filePattern="C:/apache-tomcat-7.0.23/logs/app.%i.log" it works.
> Meaning that the filePattern is not interpreted properly.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org