RE: [PATCH]: Re: Logging all requests

2004-04-14 Thread Ralph Goers
Surjan,

I have a couple of uses for this, but I'll need to modify it slightly. I
actually need access before and after the request.  Before the request I
need to do audit logging and capture the start time.  After the request I
want to update our JMX statistics.  Currently I have to do all this with a
servlet filter, but I would prefer to do this with a Cocoon component.

My proposals:
1. Change the name from RequestLogger to RequestMonitor (or something else)
as it is not necessarily a Logger and doesn't extend one.
2. Provide two methods; 
void monitorRequestStart(Environment env)
void monitorRequestEnd(Environment env)
3. Change the code in Cocoon.java to call both methods.

Note that these methods return void instead of boolean, as Cocoon.java could
care less what happened inside these calls.  Also, the calls should be
wrapped in try/catch blocks that log and ignore any errors in these methods
since, again, Cocoon.java doesn't care.

I'll be happy to provide a patch to do all this.

Ralph

-Original Message-
From: Surjan Singh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 07, 2004 9:53 AM
To: [EMAIL PROTECTED]
Subject: [PATCH]: Re: Logging all requests


 Hello,

 I'd like to log all Requests so that we can record them for analysis.

 So, far the only way I think I can do this is to modify the method
 process(..) in org.apache.cocoon. In this method, I thought I could use
 a logging component (which has yet to be created) from the component
 manager and (if it exists) to invoke a log method on it.

 What do you think? Is this the right way to go about this?

 Surj


Hello again,

Ok, I've created a patch that will do the above. Patch is attached. I 
think you'll need to do a patch -P1 from with the coocon-2.1 cvs dir.

To use the new component, add a line similar to the following in your 
cocoon.xconf:

component class=your-package.RequestLoggerImpl 
logger=requestlogger role=org.apache.cocoon.RequestLogger/

Also, there are comments in the RequestLogger interface that explain how 
to use it (a bit).

Let me know what you think.

Surj



Re: [PATCH]: Re: Logging all requests

2004-04-14 Thread Vadim Gritsenko
Ralph Goers wrote:

Surjan,

I have a couple of uses for this, but I'll need to modify it slightly. I
actually need access before and after the request.  Before the request I
need to do audit logging and capture the start time.  After the request I
want to update our JMX statistics.  Currently I have to do all this with a
servlet filter, but I would prefer to do this with a Cocoon component.
My proposals:
1. Change the name from RequestLogger to RequestMonitor (or something else)
 

I think the word you are looking for is Listener, and method names 
start on on.

Vadim


as it is not necessarily a Logger and doesn't extend one.
2. Provide two methods; 
	void monitorRequestStart(Environment env)
	void monitorRequestEnd(Environment env)
3. Change the code in Cocoon.java to call both methods.

Note that these methods return void instead of boolean, as Cocoon.java could
care less what happened inside these calls.  Also, the calls should be
wrapped in try/catch blocks that log and ignore any errors in these methods
since, again, Cocoon.java doesn't care.
I'll be happy to provide a patch to do all this.

Ralph
 

snip/



RE: [PATCH]: Re: Logging all requests

2004-04-14 Thread Ralph Goers
Sounds OK to me.  Thanks.

Ralph

-Original Message-
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 14, 2004 1:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [PATCH]: Re: Logging all requests

Ralph Goers wrote:

Surjan,

I have a couple of uses for this, but I'll need to modify it slightly. I
actually need access before and after the request.  Before the request I
need to do audit logging and capture the start time.  After the request I
want to update our JMX statistics.  Currently I have to do all this with a
servlet filter, but I would prefer to do this with a Cocoon component.

My proposals:
1. Change the name from RequestLogger to RequestMonitor (or something else)
  


I think the word you are looking for is Listener, and method names 
start on on.

Vadim


as it is not necessarily a Logger and doesn't extend one.
2. Provide two methods; 
   void monitorRequestStart(Environment env)
   void monitorRequestEnd(Environment env)
3. Change the code in Cocoon.java to call both methods.

Note that these methods return void instead of boolean, as Cocoon.java
could
care less what happened inside these calls.  Also, the calls should be
wrapped in try/catch blocks that log and ignore any errors in these methods
since, again, Cocoon.java doesn't care.

I'll be happy to provide a patch to do all this.

Ralph
  


snip/


[PATCH]: Re: Logging all requests

2004-04-07 Thread Surjan Singh

Hello,

I'd like to log all Requests so that we can record them for analysis.

So, far the only way I think I can do this is to modify the method
process(..) in org.apache.cocoon. In this method, I thought I could use
a logging component (which has yet to be created) from the component
manager and (if it exists) to invoke a log method on it.
What do you think? Is this the right way to go about this?

Surj

Hello again,

Ok, I've created a patch that will do the above. Patch is attached. I 
think you'll need to do a patch -P1 from with the coocon-2.1 cvs dir.

To use the new component, add a line similar to the following in your 
cocoon.xconf:

   component class=your-package.RequestLoggerImpl 
logger=requestlogger role=org.apache.cocoon.RequestLogger/

Also, there are comments in the RequestLogger interface that explain how 
to use it (a bit).

Let me know what you think.

Surj



request-logger-patch.bz2
Description: application/bzip