Conspicuously Absent
I was trying to debug a problem that was impacting a specific user this morning and realized there was no good way to tell from the production logs which user had
issued any particular request. I’m using ActiveAdmin for this project, which is using Devise for authentication, which uses Warden. Warden’s features don’t appear to
be available at ‘log-time’. But, with a bit of digging in the cookie jar we can pull the current admin_user.id out without too much hassle. Some posited solutions were a little
bit over-designed for my liking. I hate running around in half a dozen files to find things, so I feel like this is the easiest to understand solution. Stick this in config/initializers/logging.rb
Thanks to…
http://stackoverflow.com/questions/10811393/how-to-log-user-name-in-rails