From: Pat O'B. <obr...@gm...> - 2011-08-08 06:46:09
|
Well, I worked out a fix for this, although I am unsure if it's a good fix or not. First, here is the diff: ------------------------------>%------------------------------ wordup:server pobrien$ svn diff Index: lib/etch/server.rb =================================================================== --- lib/etch/server.rb (revision 298) +++ lib/etch/server.rb (working copy) @@ -203,12 +203,24 @@ @facts = facts @tag = tag @debug = debug - @dlogger = Logger.new(File.join(Rails.configuration.root_path, 'log', 'etchdebug.log')) - if debug - @dlogger.level = Logger::DEBUG - else - @dlogger.level = Logger::INFO + @log_dir = nil + config_file = File.join(Etch::Server.configbase, 'etchserver.conf') + if File.exist?(config_file) + IO.foreach(config_file) do |line| + # Skip blank lines and comments + next if line =~ /^\s*$/ + next if line =~ /^\s*#/ + line.chomp + if line =~ /^log_dir:/ + @log_dir = line.split.pop + end + end end + + @log_dir ? @dlogger = Logger.new(File.join(@log_dir, 'etchdebug.log')) : @dlogger = Logger.new(File.join(Rails.configuration.root_path, 'log', 'etchdebug.log')) + + debug ? @dlogger.level = Logger::DEBUG : @dlogger.level = Logger::INFO + @fqdn = @facts['fqdn'] if !@fqdn ------------------------------>%------------------------------ Here are my problems with the change: the first is that I'm not sure if this config should go into <etchbase>/etchserver.conf or if it should be within the RAILS_ROOT/config/ directory. This feels like something that should be configured along with the rails app rather than in /etc/etchserver, but from what I understand (and I am in no way, shape or form versed in rails) in rails 2.x.x there is no generic config file to handle something like this. There is a railscast ( http://railscasts.com/episodes/85-yaml-configuration-file) that touches upon this, and they basically recommend RAILS_ROOT/config/config.yml along with some other necessary changes to actually have the config file loaded. Second, it looks like the <etchbase>/etchserver.conf file is currently only used to define two things: @@auth_enabled and @@auth_deny_new_clients = nil, and the way these are loaded is by parsing the config file the same way I parse it for the log_dir setting. I would prefer etchserver.conf file to be a YAML file and we could load it that way, but I haven't looked too deeply as to what else this file is used for so I don't really want to make any recommendations on how to change it. Third, I haven't looked hard enough to see whether or not anything else references a log directory of any kind and because of my two issues above I won't bother until there's a bit more discussion on it. Other than that the change works fine and behaves as you would expect it to, your etchserver.conf file would look like this: log_dir: /whatever/directory/your/heart/desires -pat On Sun, Aug 7, 2011 at 10:19 PM, Pat O'Brien <obr...@gm...>wrote: > I've never bothered to try this so I don't know if it's configurable or > not. If it's not open a bug ticket and I'll take a look at it when I get > some spare time this week. > > Just as a side note: my personal preference is to not have system logs end > up in /var/log, but to each their own :) > > -pat > > > > On Wed, Aug 3, 2011 at 3:27 PM, Johnston, Nathaniel < > Nat...@ca...> wrote: > >> Etch Mensches, >> >> I am not sure how best to do this, but I am trying to move my Etch logs >> over to /var along with the other logfiles I have. I noticed that on line >> 205 of lib/etchserver.rb the etchdebug.log file is specified as: >> >> @dlogger = Logger.new(File.join(Rails.configuration.root_path, 'log', >> 'etchdebug.log')) >> >> Is there a way that this could leverage the value of >> config.log_path/paths.log or another configurable parameter so that we could >> override the location of this file? >> >> --N. >> >> >> >> >> ------------------------------------------------------------------------------ >> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >> The must-attend event for mobile developers. Connect with experts. >> Get tools for creating Super Apps. See the latest technologies. >> Sessions, hands-on labs, demos & much more. Register early & save! >> http://p.sf.net/sfu/rim-blackberry-1 >> _______________________________________________ >> etch-users mailing list >> etc...@li... >> https://lists.sourceforge.net/lists/listinfo/etch-users >> > > |