You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Greg Steuck <gr...@nest.cx> on 2003/02/01 19:16:00 UTC
Sevak Jetty request logging (access_log)
Hello,
I'm running Sevak/Jetty and I would like to log processed requests.
There seems to exist 2 ways to do that: use Jetty's native request
logging or implement logging at the Avalon container layer. I feel it's
beneficial to have all logging controlled in one place: the container.
Fortunately Jetty is very flexible, so what we can do is implement
interface org.mortbay.http.RequestLog and then pass this implementation
to setRequestLog of org.mortbay.jetty.Server that JettySevak builds.
Jetty already comes with NCSARequestLog implementing RequestLog. In my
opinion it is a bit too specialized for Jetty use to be reused for our
purposes.
We can enable Avalon space logging in Sevak Jetty by performing the
following steps:
* declare o.a.a.a.sevak.blocks.jetty.RequestLogger role
with a sole method
void log(HttpRequest request, HttpResponse response, int responseLength)
* make o.a.a.a.sevak.blocks.jetty.JettySevak dependent on
RequestLogger service
* setRequestLog for Server in JettySevak.initialize() using a simple
adapter from RequestLogger to org.mortbay.http.RequestLog. That
adapter will provide empty implementations of
org.mortbay.util.LifeCycle methods (they are not needed for our
component that has its lifecycle managed in Avalon container)
* create NullRequestLogger with empty implementation of log()
* create NCSARequestLogger that logs request information in NCSA
(== apache httpd) format, to do that a portion of NCSARequestLog.log
code from Jetty can be copied (provided Mort Bay Consulting doesn't mind
our relicensing some 45 lines under Apache license)
Thoughts?
Thanks
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
Re: Sevak Jetty request logging (access_log)
Posted by Greg Steuck <gr...@nest.cx>.
>>>>> "Paul" == Paul Hammant <Pa...@yahoo.com> writes:
Paul> Greg (Steuck), Go for it dude. Submit me the patch via the
Paul> mail list, and I'll commit it to the AvalonApps CVS depot.
It's at http://home.nest.cx:8/greg/jetty-sevak-patch.tgz
I took the liberty to include 4.2.5 -> 4.2.6 version update into the
patch. I also changed the assembly and environment files for jetty demo
application. It writes apache-style access_log file now.
On the issue of logging efficiency:
* RequestLogger is invoked through a proxy which gotta be slow, is
there a way to ask Phoenix to pass a direct component reference
without wrapping a proxy around?
* Since NCSARequestLog builds complete messages in code and format is
fixed, I'm pretty sure we could do better a job by using something like
RawFormatter for writing access log. Anybody care to change
jetty-environment.xml to do so? (I didn't find many LogKit usage
examples and its documentation somehow escapes me)
Paul> On the license issue, I've done the work so far under Apache
Paul> license with Greg Wilkin's knowledge, but maybe 45 lines is
Paul> too much.
Greg Wilkin just said it's OK, so I did copy it.
Thanks
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
Re: Sevak Jetty request logging (access_log)
Posted by Paul Hammant <Pa...@yahoo.com>.
Greg (Steuck),
Go for it dude. Submit me the patch via the mail list, and I'll commit
it to the AvalonApps CVS depot. You've seen PhoenixLogSink and it was
not so complicated.
On the license issue, I've done the work so far under Apache license
with Greg Wilkin's knowledge, but maybe 45 lines is too much. If that
is the case then we could move the entire block to SourceForge and use
Mortbay's own license rather than Apache. It would be a sister project
to Jetty itself , depending on it, the minimal Sevak jar and
Avalon-Framework of course.
Thoughts?
Regards,
- Paul
>Hello,
>
>I'm running Sevak/Jetty and I would like to log processed requests.
>There seems to exist 2 ways to do that: use Jetty's native request
>logging or implement logging at the Avalon container layer. I feel it's
>beneficial to have all logging controlled in one place: the container.
>
>Fortunately Jetty is very flexible, so what we can do is implement
>interface org.mortbay.http.RequestLog and then pass this implementation
>to setRequestLog of org.mortbay.jetty.Server that JettySevak builds.
>Jetty already comes with NCSARequestLog implementing RequestLog. In my
>opinion it is a bit too specialized for Jetty use to be reused for our
>purposes.
>
>We can enable Avalon space logging in Sevak Jetty by performing the
>following steps:
>
>* declare o.a.a.a.sevak.blocks.jetty.RequestLogger role
> with a sole method
> void log(HttpRequest request, HttpResponse response, int responseLength)
>* make o.a.a.a.sevak.blocks.jetty.JettySevak dependent on
> RequestLogger service
>* setRequestLog for Server in JettySevak.initialize() using a simple
> adapter from RequestLogger to org.mortbay.http.RequestLog. That
> adapter will provide empty implementations of
> org.mortbay.util.LifeCycle methods (they are not needed for our
> component that has its lifecycle managed in Avalon container)
>* create NullRequestLogger with empty implementation of log()
>* create NCSARequestLogger that logs request information in NCSA
> (== apache httpd) format, to do that a portion of NCSARequestLog.log
> code from Jetty can be copied (provided Mort Bay Consulting doesn't mind
> our relicensing some 45 lines under Apache license)
>
>Thoughts?
>
>Thanks
>Greg
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
Re: [jetty-discuss] Sevak Jetty request logging (access_log)
Posted by Greg Wilkins <gr...@mortbay.com>.
Greg Steuck wrote:
> * create NCSARequestLogger that logs request information in NCSA
> (== apache httpd) format, to do that a portion of NCSARequestLog.log
> code from Jetty can be copied (provided Mort Bay Consulting doesn't mind
> our relicensing some 45 lines under Apache license)
Well that should be OK, seeing that I probably borrowed those 45 lines from
apache. It is their log format after all :-)
cheers
--
Greg Wilkins<gr...@mortbay.com> Phone/fax: +44 7092063462
Mort Bay Consulting Australia and UK. http://www.mortbay.com
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org