Re: Logging every request into db

2008-04-17 Thread Artur W.


Gerolf Seitz wrote:
> 
> you could do that in your own WebRequestCycle subclass in the
> onBeginRequest method.
> 

Thanks, This was exactly what I was looking for!

Artur

-- 
View this message in context: 
http://www.nabble.com/Logging-every-request-into-db-tp16740900p16743061.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Logging every request into db

2008-04-17 Thread Gerolf Seitz
you could do that in your own WebRequestCycle subclass in the
onBeginRequest method.

  Gerolf

On Thu, Apr 17, 2008 at 10:12 AM, Artur W. <[EMAIL PROTECTED]> wrote:

>
> Hi!
>
> I need to log every request (session id, ip address, user id, url,
> response
> time etc) into db.
>
> The code is simply:
>
>RequestCycle requestCycle = RequestCycle.get();
>HttpServletRequest servletRequest =
> ((WebRequest)requestCycle.getRequest()).getHttpServletRequest();
>AdminSession adminSession = (AdminSession)
> requestCycle.getSession();
>
>log.info(adminSession.getId() + " " +
>servletRequest.getRemoteAddr() + " " +
>adminSession.getWorkerId() + " " +
>servletRequest.getRequestURL() + " " +
>(System.currentTimeMillis() -
> requestCycle.getStartTime()));
>
> But I don't know where to put it. I tried to add it the the WicketFilter:
>
> public class MyWicketFilter extends WicketFilter {
>
>@Override
>public void doFilter(ServletRequest request, ServletResponse response,
> FilterChain chain) throws IOException, ServletException {
>
>super.doFilter(request, response, chain);
>
>RequestCycle requestCycle = RequestCycle.get();
>//  logging goes here
>
>}
> }
>
> But RequestCycle.get() returns null.
>
>
> I will appreciate any suggestions.
>
>
> Thanks,
> Artur
>
>
> --
> View this message in context:
> http://www.nabble.com/Logging-every-request-into-db-tp16740900p16740900.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Logging every request into db

2008-04-17 Thread Artur W.

Hi!

I need to log every request (session id, ip address, user id, url, response
time etc) into db.

The code is simply:

RequestCycle requestCycle = RequestCycle.get();
HttpServletRequest servletRequest =
((WebRequest)requestCycle.getRequest()).getHttpServletRequest();
AdminSession adminSession = (AdminSession)
requestCycle.getSession();

log.info(adminSession.getId() + " " +
servletRequest.getRemoteAddr() + " " +
adminSession.getWorkerId() + " " +
servletRequest.getRequestURL() + " " +
(System.currentTimeMillis() - requestCycle.getStartTime()));

But I don't know where to put it. I tried to add it the the WicketFilter:

public class MyWicketFilter extends WicketFilter {

@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {

super.doFilter(request, response, chain);

RequestCycle requestCycle = RequestCycle.get();
//  logging goes here

}
}

But RequestCycle.get() returns null.


I will appreciate any suggestions.


Thanks,
Artur


-- 
View this message in context: 
http://www.nabble.com/Logging-every-request-into-db-tp16740900p16740900.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]