Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1056

Do not log system.out after roll - RollingFileAppender

    XMLWordPrintable

Details

    Description

      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 precession is ok, but this new log, after the turn does not allow login with system.out and therefore fails to log the webservice request.

      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>

      <logger name="org.hibernate" level="OFF" />
      <logger name="org.springframework" level="OFF" />
      <logger name="org.springframework.transaction" level="OFF" />
      <logger name="org.springframework.security" level="OFF" />
      <logger name="org.springframework.web.servlet.mvc" level="INFO" />

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

      What can I do to solve this problem?

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            giovanischram Giovani Schram
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: