SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    0 Post(s)
    0 Thread(s)

    Different Log File For Certain Controller

    I have a controller I would like to change where it logs to. It gets about 100,000 hits a day so I would like to designate a file so just that controller logs to it, so all the other ones can log into production.log.

    I can't find any way to overwrite the environment.rb during runtime.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    West Springfield, Massachusetts
    198 Post(s)
    3 Thread(s)
    I'm still a RoR newbie, but it seems something suitable might be possible
    Using different loggers for different parts of rails

    Since Rails 2.0, something similar is done in "Rails::Initializer#initializelogger": and initialize_framework_logging instead of in environment.rb as stated below._

    environment.rb defines the loggers used by the components of rails. First it defines the default logger for the application :
    Say you want Active record to log in database.log instead of the default #{RAILS_ENV}.log file. You can add the following to the end of your #{RAILS_ROOT}/config/#{RAILS_ENV}.rb file (for example to development.rb):

  3. #3
    SitePoint Enthusiast TomK32's Avatar
    Join Date
    Mar 2008
    Berchtesgaden, Germany
    0 Post(s)
    0 Thread(s)
    Garrett if it's really like 100k hits I guess you could think about page caching so your webserver is the only thing that worries about most of the hits which makes your applications log file shorter

    And about downtime: Those 10 seconds must be possible. Anytime.
    just a geek trying to change the world
    I'm a ruby on rails developer in Vienna, Austria. My github.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts