Hi learning, use Tapestry's RequestGlobals service (http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/services/RequestGlobals.html). It gives you access to the HttpServletRequest which inherits a method getRemoteAddr() from ServletRequest.
You can inject RequestGlobals into your RequestLoggingFilter e.g. as constructor parameter. The class would look like public class RequestLoggingFilter implements RequestFilter { public final RequestGlobals reqGlobs; public RequestLoggingFilter(final RequestGlobals reqGlobs) { this.reqGlobs = reqGlobs; } public boolean service(Request request, Response response, RequestHandler handler) throws IOException { MDC.put("remoteIP", this.reqGlobs.getHTTPServletRequest.getRemoteAddr()); return handler.service(request, response); } } your build-method would look like public RequestFilter buildRequestLoggingFilter(final RequestGlobals reqGlobs) { return new RequestLoggingFilter(reqGlobs); } Regards, nillehammer == http://www.winfonet.eu ----- original Nachricht -------- Betreff: Log remote IP address with MDC class? Gesendet: Do, 16. Jul 2009 Von: learningtapestry<satish...@yahoo.com> > > Is there any way to log the remote IP address using the log4j MDC. If I > contribute to RequestHandler inside my AppModule, I have a way of getting a > hold of the org.apache.tapestry5.services.Request, but from this Request, > there isn't no way of getting the IP address of the remote machine. > > I don't want to add this my pages/components for various reasons. > > > public RequestFilter buildRequestLoggingFilter(){ > return new RequestFilter(){ > public boolean service(Request request, Response response, > RequestHandler handler) throws IOException { > MDC.put("remoteIP", ???????????? ); > return handler.service(request, response); > } > }; > } > > > > > -- > View this message in context: > http://www.nabble.com/Log-remote-IP-address-with-MDC-class--tp24508725p24508 > 725.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --- original Nachricht Ende ---- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org