ruby - Rails development logging - Rails.logger filename nil? -
i'm having trouble logging in development environment.
here's rails.logger looks like:
loading development environment (rails 3.2.13) irb(main):001:0> rails.logger => #<activesupport::taggedlogging:0x007fe83533caa0 @logger=#<logger:0x007fe83533cc30 @progname=nil, @level=1, @default_formatter=#<logger::formatter:0x007fe83533cbe0 @datetime_format=nil>, @formatter=#<logger::simpleformatter:0x007fe83533caf0 @datetime_format=nil>, @logdev=#<logger::logdevice:0x007fe83533cb90 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<io:/dev/ttys023>, @mutex=#<logger::logdevice::logdevicemutex:0x007fe83533cb68 @mon_owner=nil, @mon_count=0, @mon_mutex=#<mutex:0x007fe83533cb18>>>>> irb(main):002:0> my log directory permissioned 755:
drwxr-xr-x 7 manderson staff 238b oct 4 15:17 log here's contents of /log directory looks like:
$ ls -lah log/ total 32 drwxr-xr-x 7 manderson staff 238b oct 4 15:17 . drwxr-xr-x@ 23 manderson staff 782b oct 4 15:38 .. -rw-r--r-- 1 manderson staff 0b aug 26 13:23 .gitkeep -rw-rw-rw- 1 manderson staff 0b oct 4 15:38 development.log -rw-r--r-- 1 manderson staff 13k oct 7 10:43 newrelic_agent.log -rw-r--r-- 1 manderson staff 0b oct 4 15:38 production.log -rw-rw-rw- 1 manderson staff 0b oct 4 15:38 test.log as can see, development.log file permissioned correctly (i think), rails.logger doesn't have log/development.log set properly.
any idea why happening? in advance.
edit: here's config/environment/development.rb:
myappname::application.configure # settings specified here take precedence on in config/application.rb # in development environment application's code reloaded on # every request. slows down response time perfect development # since don't have restart web server when make code changes. config.cache_classes = false # log error messages when accidentally call methods on nil. config.whiny_nils = true # show full error reports , disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :dalli_store # don't care if mailer can't send config.action_mailer.raise_delivery_errors = false # print deprecation notices rails logger config.active_support.deprecation = :log # use best-standards-support built browsers config.action_dispatch.best_standards_support = :builtin # raise exception on mass assignment protection active record models # config.active_record.mass_assignment_sanitizer = :strict # log query plan queries taking more (works # sqlite, mysql, , postgresql) # config.active_record.auto_explain_threshold_in_seconds = 0.5 # not compress assets config.assets.compress = false # expands lines load assets config.assets.debug = true config.log_level = :debug end edit 2: here's application.rb. sorry post getting lengthy, reading :)
require file.expand_path('../boot', __file__) require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "rails/test_unit/railtie" require "sprockets/railtie" if defined?(bundler) # if precompile assets before deploying production, use line bundler.require(*rails.groups(:assets => %w(development test))) # if want assets lazily compiled in production, use line # bundler.require(:default, :assets, rails.env) end module myappname class application < rails::application # settings in config/environments/* take precedence on specified here. # application configuration should go files in config/initializers # -- .rb files in directory automatically loaded. # configure default encoding used in templates ruby 1.9. config.encoding = "utf-8" # configure sensitive parameters filtered log file. config.filter_parameters += [:password] # enable escaping html in json. config.active_support.escape_html_entities_in_json = true # use sql instead of active record's schema dumper when creating database. # necessary if schema can't dumped schema dumper, # if have constraints or database-specific column types # config.active_record.schema_format = :sql # enforce whitelist mode mass assignment. # create empty whitelist of attributes available mass-assignment models # in app. such, models need explicitly whitelist or blacklist accessible # parameters using attr_accessible or attr_protected declaration. # config.active_record.whitelist_attributes = true # enable asset pipeline config.assets.enabled = true # don't load rails environment during asset precompilation config.assets.initialize_on_precompile = false # version of assets, change if want expire assets config.assets.version = '1.1' end end
Comments
Post a Comment