[logback-user] MDCInsertingServletFilter and req.remoteHost

David Roussel nabble at diroussel.xsmail.com
Thu Mar 30 22:15:16 CEST 2017


Clone MDCInsertingServletFilter and change it to use request.getRemoteAddr() which returns the IP address the caller.

Consider a pull request to fix this in logback

> On 30 Mar 2017, at 13:46, Murray, Thomas - 3 <tmurray2 at bankofamerica.com> wrote:
> 
>  Hi,
> 
> I have configured my application with the MDCInsertingServletFilter and added the %X{req.remoteHost} to my logback.xml pattern attribute.  The log is showing the fully qualified name of the client that sent the request.  However, I would like to log the IP and not the fully qualified host name.  The documentation for getRemoteHost() states "If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address".  How do I configure the engine to not resolve fully qualified host name?
> 
> Thanks in advance for your assistance,
> 
> Tom.
> 
> ----------------------------------------------------------------------
> This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended recipient, please delete this message.
> _______________________________________________
> logback-user mailing list
> logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user



More information about the logback-user mailing list