1

My app runs in Jetty8 and is leveraging Logback's RequestLogImpl (which is just great, by the way). Recently we discovered that if logback has a problem rolling over files, the logging message that would have alerted us to that appears nowhere because we had not configured Jetty to redirect its stderrout to any log file. My current release corrected that problem, but now I notice an excessive volume of INFO messages from logback in the jetty stderrout file like

06:32:14,893 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [/data/logs/md-stage-app4.dev.mgg.request.3.log] to [/data/logs/md-stage-app4.dev.mgg.request.4.log]

I only really care about these messages if the rename failed or something, which these messages come out as WARN. How can I get the logback stuff to just log at WARN and above into the jetty stderrout logfile?

My app itself does, indeed, <root level="info"> the root logger.

etc/jetty.xml has the following excerpt:

<!-- Logback Access Log implementation -->
<Ref id="RequestLog">
  <Set name="requestLog">
    <New id="requestLogImpl" class="ch.qos.logback.access.jetty.RequestLogImpl">
      <Set name="fileName">etc/logbackAccess.xml</Set>
    </New>
  </Set>
</Ref>

etc/logbackAccess.xml is:

<configuration>
  <!-- always a good activate OnConsoleStatusListener -->
  <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />

  <appender name="SIZE_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>/data/logs/md-app3.request.log</File>
    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>/data/logs/md-app3.request.%i.log</fileNamePattern>
      <minIndex>1</minIndex>
      <maxIndex>5</maxIndex>
    </rollingPolicy>
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>1MB</maxFileSize>
    </triggeringPolicy>
    <encoder>
      <pattern>%h %l %u [%t] "%r" %s %b%n%fullRequest%n</pattern>
    </encoder>
  </appender>

  <appender-ref ref="SIZE_ROLLING" />
</configuration>
Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
  • Which version of logback-classic are you using? – Ceki May 03 '13 at 21:33
  • ext.logback = [version: '1.0.11'] – Bob Kuhar May 03 '13 at 22:01
  • Did you do integrate logback-access and jetty yourself or were jetty and logback-access packaged together? – Ceki May 03 '13 at 22:16
  • I guess I'm on the "integrate logback-access and jetty yourself" program. The gradle build shoves the necessary logback JARs into a Jetty deployment directory at lib/ext: lib/ext/logback-access-1.0.11.jar and lib/ext/logback-core-1.0.11.jar – Bob Kuhar May 03 '13 at 22:56
  • It's a popular program. :-) Could you please post your logback-access.xml file? – Ceki May 03 '13 at 23:13
  • In my deployment we've named it etc/logbackAccess.xml, but I think thats the file you are asking for and I put its content up in the question. The INFO messages aren't wrong, the file is rolling over frequently. I'm just looking for a way to turn them off. The logback.xml that the whole application uses comes in on a -Dlogback.configurationFile=/opt/md/logback.xml when we "./bin/jetty.sh start" – Bob Kuhar May 03 '13 at 23:42

1 Answers1

1

The status messages are printed because of the line

<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />

in logback-access.xml (etc/logbackAccess.xml in your case). By adapting OnConsoleStatusListener and OnPrintStreamStatusListenerBase, you should be able able to create a custom StatusListener which prints status messages except INFO messages originating at RenameUtil.

Ceki
  • 26,753
  • 7
  • 62
  • 71
  • It should be fairly easy to do. Holler on the logback-user@ mailing list if you run into trouble. – Ceki May 06 '13 at 17:16