[logback-dev] Do not log system.out after roll - RollingFileAppender

Giovani Schram schram.giovani at gmail.com
Thu Mar 26 19:07:54 CET 2015


Hello guys,


I am using tomcat server, maven, spring framework and logback.

I'm trying to use RollingFileAppender but I have a big problem. I need to
log the contents of a web service request that is logged as system.out.
When I start the server logs everything normally, both logs using
org.slf4j.LoggerFactory as system.out, but when you turn the log at
midnight, it generates a backup of the old log and created a new log. This
process is ok, but this new log, after the turn does not allow loggin with
system.out and therefore fails to logging the webservice request and
response.

Below is my logback:

<configuration scan="true" scanPeriod="30 seconds">

<property name="LOG_PATH" value="${TOMCAT_HOME}/logs" />
<property name="LOG_PATH_BACKUP" value="${TOMCAT_HOME}/logs/backup" />

<appender name="SERVER"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/server.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<FileNamePattern>${LOG_PATH_BACKUP}/server/server.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
</rollingPolicy>
<encoder>
<Pattern>%green(%d) %highlight(%-5level) %cyan(%logger{0}) mdc=%X{id}%msg
%n</Pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="SERVER" />
</root>
</configuration>

What can I do to solve this problem, please?



 ---------------------------
Att,
Giovani Schram
---------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20150326/db9376ef/attachment-0001.html>


More information about the logback-dev mailing list