You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Liav Elias <Li...@audiocodes.com> on 2014/07/29 07:29:53 UTC

RollingFile appender in tomcat 7 with log4j2

Hi,

I am trying to configure RollingFile appender in tomcat 7 with log4j2 with 5 log files.
I am using in the filePattern the ${sys:catalina.base} but in the log I see the error:

ERROR Unable to create directory C:\eclipse\    omcat7\logs

The same happen if I run tomcat from outside the eclipse (path is different but still there is space in the path).
When I use a path which is hardcoded (C:/temp) it works.
I also tried it with catalina.base and I get the same result.
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
Here is the full appender I use:

<RollingFile name="MyLogFile" fileName="${sys:catalina.home}/logs/MyLog.log"
                 filePattern="${sys:catalina.home}/logs/MyLog-%i.log">
      <PatternLayout>
        <Pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{3} %x - %m%n</Pattern>
      </PatternLayout>
      <Policies>
        <SizeBasedTriggeringPolicy size="10KB"/>
      </Policies>
      <DefaultRolloverStrategy max="5" min="1"/>
</RollingFile>


Thanks for the help,
Liav
This email and any files transmitted with it are confidential material. They are intended solely for the use of the designated individual or entity to whom they are addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful.

If you have received this email in error please immediately notify the sender and delete or destroy any copy of this message