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
Post a Comment