Forum: Ruby on Rails Adding user name to production log?

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.
25bbc96d9c53647354cb724e744b2222?d=identicon&s=25 Greg Freemyer (Guest)
on 2006-05-11 18:14
(Received via mailing list)
All,

In the production log I have entries like:

Processing OpportunityController#new (for 68.213.19.251 at 2006-05-11
10:18:36) [GET]
  Session ID: 345b455a2a36af8814081c388d8726f1
  Parameters: {"action"=>"new", "controller"=>"opportunity"}
Rendering  within layouts/opportunity
Rendering opportunity/new
Completed in 0.02281 (43 reqs/sec) | Rendering: 0.01585 (69%) | DB:
0.00271 (11%) | 200 OK [https://68.213.19.251/opportunity/new]

I would like to add the user's login name.  Is there an easy way for
me to extend the above and add it?  Obviously I have it in a session
variable, I just don't know where to add the log statement.

Greg
--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
E3c79c779c0b390049289cdfe7cb9705?d=identicon&s=25 Bob Hutchison (Guest)
on 2006-05-11 18:26
(Received via mailing list)
On May 11, 2006, at 12:12 PM, Greg Freemyer wrote:

> Completed in 0.02281 (43 reqs/sec) | Rendering: 0.01585 (69%) | DB:
> 0.00271 (11%) | 200 OK [https://68.213.19.251/opportunity/new]
>
> I would like to add the user's login name.  Is there an easy way for
> me to extend the above and add it?  Obviously I have it in a session
> variable, I just don't know where to add the log statement.

Coincidentally, I did this the other day from inside an around filter
by writing something like:

controller.logger.info "blah blah blah"

in the before method.

Don't know if there's a better way.

Cheers,
Bob

>
> Greg
> --
> Greg Freemyer
> The Norcross Group
> Forensics for the 21st Century
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails

----
Bob Hutchison                  -- blogs at <http://www.recursive.ca/
hutch/>
Recursive Design Inc.          -- <http://www.recursive.ca/>
Raconteur                      -- <http://www.raconteur.info/>
xampl for Ruby                 -- <http://rubyforge.org/projects/xampl/>
D5145c421cd25af6fa577c15219add90?d=identicon&s=25 unknown (Guest)
on 2006-05-11 18:29
(Received via mailing list)
A better way? That's one very simple line of code. You can't get much
better than that.
-N
This topic is locked and can not be replied to.