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 8784359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:04:01+00:00 2026-06-13T21:04:01+00:00

I have a download action in my controller that is logged when the user

  • 0

I have a download action in my controller that is logged when the user clicks on the download link. Is there any way to track how long it took for the download to complete or at least that it was successful?

Here is the download action in the controller (Rails 3.2.8):

def download
    send_file @download.attachment.path, :filename => @download.attachment_file_name,
                                         :content_type => @download.attachment_content_type

    DownloadsLog.debug "log details here! -- at #{Time.now}"
end

downloads_log.rb model

class DownloadsLog
  def self.debug(message=nil)
    @@downloads_log ||= Logger.new("#{Rails.root}/log/downloads.log", 10, 1024000)
    @@downloads_log.debug(message) unless message.nil?
  end
end

Maybe it’s not possible but I thought I would ask if anyone had any ideas…

Thanks!

  • 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-13T21:04:02+00:00Added an answer on June 13, 2026 at 9:04 pm

    In Rails 3, wrap a section of code in a block, and supply it to the method benchmark.

    benchmark "<My identifying label>" do
      # do this and that...
    end
    

    In your log, you’ll see a line that indicates how long your block took to execute:

    <My identifying label> (138.8ms)
    

    You can even use this in a view:

    <% benchmark "Process data files" do %>
      <%= expensive_files_operation %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a link <a id=DownloadLink href='controller/action' target=_blank>Download File</a> that has to open a
I have a controller action that allows a user to download a file with
I have a controller action that builds a pdf and than downloads it by
I have one Download PDF Image link, I am calling an action of a
I have a page in my website that requires a simple file download link.
I have a CakePHP controller action where I would like to let the user
I have an Zend Application that generate URL like that http://miapp.com/module/controller/action/params/values I want to
I have written a controller action that checks for the existence of a PDF
I have a rails app that allows a user to download a generated CSV
I have a app which will download a file from web. The download action

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.