nomiddlename/log4js-node — pull request #168 by macedigital (2013-12-21 18:58:21+00:00)
Title: fix 'remote-addr' property in connect-logger

This patch fixes an issue with 'connect-logger' inserting the wrong `remote-addr` into all logs if an application is running behind a reverse-proxy.

Connect will set the `req.ip` to the correct remote-addr, but as of now this property is not used at all in the log4js logging middleware.

What I did: adapt the `remote-addr` replacement to what connect is doing, https://github.com/senchalabs/connect/blob/master/lib/middleware/logger.js#L303.

There is no (new) test, because the existing ones work as they did before. `req.ip` and/or `req._remoteAddress` simply have precedence now when the client ip is requested.