We have multiple applications on a tomcat which are using System.out.println statements logging to catalina.out. There is a single application which creates a lot of log statements so I would like to log those application outpout to a separate logfile instead.
I have created a log4j.xml setup which logs only WARN level to catalina.out. But the RollingFileAppender does not yet work for the System.out statements and I am not sure, what to change.
I would like to not touch the other applications. Is that possible somehow?
<Configuration status="INFO">
<Appenders>
<Console name="stdout" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level %logger{36}: %msg%n" />
</Console>
<RollingFile
name="logFile"
fileName="../logs/app/log.log"
filePattern="../logs/app/log.%d{yyyy-MM-dd}.log.gz"
ignoreExceptions="false">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"/>
</Policies>
<DefaultRolloverStrategy max="31" />
</RollingFile>
<Async name="logFile_async">
<AppenderRef ref="logFile"/>
</Async>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="stdout" />
</Root>
<Logger name="my.company.logger" level="DEBUG">
<AppenderRef ref="logFile_async"/>
</Logger>
</Loggers>
</Configuration>