When I start a Rails server with $ mongrel_rails start --chdir ~/railsapp --port 3003 --pid \ /home/me/railsapp/tmp/pids/mongrel.pid --daemonize the server starts and opens two log files, development.log and mongrel.log. Both have permissions -rw-rw-rw-. If I omit --deamonize, it opens one log file, development.log, with permissions -rw-r--r--. I would like to make the server use permissions of my choice in either case. How to do that? Thanks -- KM
Don''t know the answer yet (did you try setting umask on the logs directory?) But do you know that by the time you go to production (and file permissions on logs become important), the log file name MUST be production.log, not development.log? Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070309/add1bee8/attachment-0001.html
On Fri, 9 Mar 2007 10:48:31 -0800 km at acrasis.net wrote:> When I start a Rails server with > > $ mongrel_rails start --chdir ~/railsapp --port 3003 --pid \ > /home/me/railsapp/tmp/pids/mongrel.pid --daemonize > > the server starts and opens two log files, development.log and > mongrel.log. Both have permissions -rw-rw-rw-. > > If I omit --deamonize, it opens one log file, development.log, with > permissions -rw-r--r--. > > I would like to make the server use permissions of my choice in > either case. How to do that?If it''s configurable you''d configure it in Rails not Mongrel (since that log is created by Rails, not Mongrel). Look at the documentation for the Logger class in Ruby, but DO NOT use Logger''s rotation feature. It will crash your system hard. You should also check your umask for the user that you''re running as a daemon. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://www.awprofessional.com/title/0321483502 -- The Mongrel Book http://mongrel.rubyforge.org/
On 2007-03-09 14:48, Zed A. Shaw wrote:> > If it''s configurable you''d configure it in Rails not Mongrel (since > that log is created by Rails, not Mongrel). Look at the documentation > for the Logger class in Ruby, but DO NOT use Logger''s rotation > feature. It will crash your system hard.Thank you. I found that adding this Rails::Initializer.run do |config| ... File.umask(026) if 0 == File.umask end into my Rails environment.rb has the desired effect on development.log. It has no effect on mongrel.log. Is that log file created by Rails?> You should also check your umask for the user that you''re running as a > daemon.The user''s umask seems not to matter because Daemonize unconditionally clears the umask. By editing the source (daemonize.rb line 219), it is possible to determine what mongrel.log''s permissions will be. Hopefully a better solution is possible? -- KM