Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Customing Request Logging

Thanks,
Already had ext in OPTIONS.  Just knowing that it should work, got me double checking absolutely everything else.  Including making sure there was actually a class of that name in the jar.  Edited an Ant script.  It works now!


----- Original Message -----
From: joakim@xxxxxxxxxxx
To: info@xxxxxxxxxxxxxxxxx
Sent: Fri, February 24, 2012, 5:55 PM
Subject: Re: [jetty-users] Customing Request Logging

Use the command line ...
 
$ java -jar start.jar --version
 
And verify that your expected jar file is present in the list presented to you.
If not, then you'll likely need to add the ext directory to your OPTIONS line.
See the start.ini for the OPTIONS line.
 
Example: line #49
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-distribution/src/main/resources/start.ini

--
Joakim Erdfelt
 
(the people behind jetty and cometd)



On Fri, Feb 24, 2012 at 3:47 PM, Jeff Palmer <info@xxxxxxxxxxxxxxxxx> wrote:

I wanted to customize logging, to only show un-successful requests. The servlets do their own application specific tracking, so writing out those is un-neccessary. Wrote this class & placed the jar in lib/ext:

package jettyReplacements;

import org.eclipse.jetty.server.*;

public final class RequestLogger extends NCSARequestLog{
public RequestLogger(){
super();
}

public RequestLogger(final String filename){
super(filename);
}

@Override
public void log(final Request request, final Response response){
if (response.getStatus() != 200) super.log(request, response);
}
}


I copied etc/jetty-requestlog.xml, edit it as shown below, & referenced it in start.ini:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Configure the Jetty Request Log -->
<!-- =============================================================== -->

<Configure id="Server" class="org.eclipse.jetty.server.Server">

<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- =========================================================== -->
<Ref id="Handlers">
<Call name="addHandler">
<Arg>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="RequestLogImpl" class="jettyReplacements.RequestLogger">
<Set name="filename"><Property name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">30</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">EST</Set>
</New>
</Set>
</New>
</Arg>
</Call>
</Ref>

</Configure>


Starting fails, however with:
Exception in thread "main" java.lang.ClassNotFoundException: jettyReplacements.RequestLogger

Anything I forgot to do?

Thanks!


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top