Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] unified logback log getting disjointed

I have tried to direct my server and servlet logs to the same file, but it seems the server is out of sync and starts its own new logfile when it gets bad HTTP, yet the servlets continue logging to the old, now-renamed files.

You can see it here:

-rw-r--r-- 1 root  root      141 May  6 06:10 jetty.log
-rw-r--r-- 1 root  root    54954 May  6 06:13 jetty_2016-05-05.log

$ cat logs/jetty.log
05/06 06:10:56.730 WARN org.eclipse.jetty.http.HttpParser - bad HTTP parsed: 400 for HttpChannelOverHttp@461a49db{r=0,c=false,a=IDLE,uri=-}

When setting up, I tried following the instructions for unified logback logging, but wind up with logging complaints below. One suspect thing I notice is that I have logfile defined in log4j properties and logback xml.

Here is my setup:

$ grep '^[a-zA-Z]' jetty-base/start.ini
jetty.threadPool.minThreads=5
jetty.threadPool.maxThreads=50
jetty.http.port=80
jetty.server.stopAtShutdown=true
jetty.deploy.monitoredDir=webapps

--- jetty-base/resources//jetty-logging.properties

org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog

--- jetty-base/resources//log4j.properties

log4j.rootLogger=info, A1
log4j.additivity.FileLog=false
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=/home/me/ops/jetty-base/logs/jetty.log # not touched since Oct
log4j.appender.A1.MaxFileSize=1MB
# log4j.appender.A1.MaxBackupIndex=1
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n


--- jetty-base/resources/logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>/home/me/ops/logs/jetty.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/home/me/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>

  <root level="info">
    <!-- appender-ref ref="STDOUT" / -->
    <appender-ref ref="FILE" />
  </root>
</configuration>


--- at startup

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/me/ops/jetty-base/lib/logging/logback-classic-1
.0.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/me/ops/jetty-base/lib/logging/slf4j-log4j12-1.6
.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

2016-05-04 18:42:08 INFO  MLog:80 - MLog clients using log4j logging.

I tried to resolve the multiple bindings, and posted about it before,

  https://dev.eclipse.org/mhonarc/lists/jetty-users/msg06501.html

but if there was an answer I can't find it. It also seems that a log file might be deleted when I kill/restart jetty, since I periodically notice missing log lines that I grepped the day before, so that's why I'm asking again. (I want to know how many users I have for my new feed of a molecular dynamics simulation, and a day's data is missing.)

Thanks,

Bill

http://phobrain.com/pr/home/mol.html




Back to the top