Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] log rolls but servlet still logs to previous log

I set up logback logging as described in the doc, but my servlets are not following the log rollover, still logging to yesterday's (renamed) log, while today's jetty.log just has this one msg in it:

10/23 01:54:53.391 WARN  org.eclipse.jetty.http.HttpParser - Illegal character 0x1 in state=START for buffer HeapByteBuffer@4f3586a7[p=1,l=256,c=8192,r=255]={\x01<<<\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01...\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01>>>a/5.0 (compatible...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
10/23 01:54:53.392 WARN  org.eclipse.jetty.http.HttpParser - bad HTTP parsed: 400 Illegal character 0x1 for HttpChannelOverHttp@51ff7d2b{r=0,c=false,a=IDLE,uri=-}

$ ls logs
jetty_2015-10-20.log  jetty_2015-10-21.log  jetty_2015-10-22.log  jetty.log
$ tail -1 logs/jetty_2015-10-22.log
0/23 11:27:09.751 INFO  c.p.s.FileSystemResourceServlet - Mapping bg/x.jpg to /home//web/bg/x.jpg

My jetty-base/resources/logback.xml for the file:

  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/home/ops/logs/jetty.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <fileNamePattern>/home/ops/logs/jetty_%d{yyyy-MM-dd}.log</fileNamePattern>
      <!-- maxHistory>30</maxHistory -->
    </rollingPolicy>

    <encoder>
      <pattern>%d{MM/dd HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

One suspicious symptom is on startup I see:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/tmp/jetty-0.0.0.0-80-pr.war-_pr-any-3162207590915625508.dir/webapp/WEB-INF/lib/logback-classic-1.0.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/ops/jetty-base/lib/logging/logback-classic-1.0.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/ops/jetty-base/lib/logging/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]

I tried getting rid of this by witholding jars from my war, but this led to another problem.

One irritating thing I found is that you can't specify the location of logback.xml on the cmd line per the logback doc, because jetty requires it to be in jetty-base/resources.

Thanks for any help,
Bill


Back to the top