ruby - How to intercept information from a Rails logger? -


i'm using rails v2.3.5 @ work , i'm quite new both language , framework. need capture information every time user requests webpage (user's ip address, url accessed, date , time of access , time page took render) , store in database.

i've noticed information contained in default rails' logfiles, i'm trying avoid having parse logfile collect information. way hook logger , intercept information or perhaps extend logger , use extended version instead of default rails 1 (activesupport::bufferedlogger).

maybe ever other solutions don't require logs?

thanks in advance.

what need before_filter block in applicationcontroller perform whatever action need do. there can create whatever database records need. example:

class applicationcontroller < actioncontroller::base   before_filter :log_user_info  protected   def log_user_info     # activate custom logging method on model     useractivity.log!(       # ... user parameters     )   end end 

hooking in logger bad idea that's indirect way information. may need extract data historical reasons, though.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -