SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    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
    Location
    West Springfield, Massachusetts
    Posts
    17,156
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I'm still a RoR newbie, but it seems something suitable might be possible http://wiki.rubyonrails.org/rails/pa...nfigureLogging
    Using different loggers for different parts of rails

    Since Rails 2.0, something similar is done in "Rails::Initializer#initializelogger":http://github.com/github/rails/tree/c8da518bbfedc2a06b1d96912ddae00e57f21748/railties/lib/initializer.rb#L238-266 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
    Location
    Berchtesgaden, Germany
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    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

Bookmarks

Posting Permissions

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