Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8057929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:11:31+00:00 2026-06-05T09:11:31+00:00

I want to write a logging model and controller, to log everything that user

  • 0

I want to write a logging model and controller, to log everything that user does. I was thinking about creating a db table with from ip address, controller that user called, view that was displayed and params.inspect.

Is there a way to get to a variable which controller is currently being used? What is the best way to deploy this? Is out there a gem that do all this?
Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:11:33+00:00Added an answer on June 5, 2026 at 9:11 am

    If you set the log level in production to :debug then every request is logged with the information you need. Perhaps, it might be easier to write a parser for the debug production log.

    If you prefer, you can also add a filter to your ApplicationController:

    class ApplicationController
      before_filter :log_activity
    
      def log_activity
        if Rails.env == 'production'
          @logger ||= Logger.new("#{Rails.root}/log/activity.log")
          values = [
            request.remote_ip,
            controller_name,
            action_name,
            params.inspect
          ]
          @logger.info "#{values.join ' | '}"
        end
      end
    
      ...
    end
    

    this might not be complete as you want the output to be more verbose, but this is the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program I'm writing that I want to write a custom logging
I want to write a regular expression in F# that represents strings which start
I have a MediaPlayer playing a file, and I want to continuously write logging
I want to use the Write-Ahead Logging feature of SQLite in a j2se program.
I want to write a small program that given a time (in minutes) as
I want to develop logging system in OSGI bundle which can write application errors
I'm starting to write a small web application and have started thinking about securing
I want to write a Java program that'll access a few web pages that
I have a macro that might look as follows (from boost log library) #define
I want to write some unit tests for an interceptor that intercepts the Loggable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.