Forum: Ruby on Rails RE: logging a users ip address

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F01c3ff32fee35d911e81c172a005012?d=identicon&s=25 Tom Fakes (Guest)
on 2005-12-27 08:55
(Received via mailing list)
Typically, this information is added to the access log by the web
server.

The Rails default logging also outputs this information, even in
production mode:

  Processing <controller>#<action> (for <user-ip> at <date-time>) GET


If you want to put this in the Rails log file in your own format, it can
be found in your request.env collection under REMOTE_HOST, e.g.

	logger.info "Users IP: #{request.env['REMOTE_HOST']}"
This topic is locked and can not be replied to.