lib/new_relic/control/frameworks/rails.rb in newrelic_rpm-3.5.4.35.beta vs lib/new_relic/control/frameworks/rails.rb in newrelic_rpm-3.5.5.38
- old
+ new
@@ -15,13 +15,10 @@
RAILS_ROOT.to_s
else
super
end
end
- def logger
- ::RAILS_DEFAULT_LOGGER
- end
def rails_config
if defined?(::Rails) && ::Rails.respond_to?(:configuration)
::Rails.configuration
else
@@ -44,13 +41,13 @@
end
end
if !Agent.config[:agent_enabled]
# Might not be running if it does not think mongrel, thin, passenger, etc
# is running, if it thinks it's a rake task, or if the agent_enabled is false.
- log!("New Relic Agent not running.", :debug)
+ ::NewRelic::Agent.logger.info("New Relic Agent not running.")
else
- log! "Starting the New Relic Agent."
+ ::NewRelic::Agent.logger.info("Starting the New Relic Agent.")
install_developer_mode rails_config if Agent.config[:developer_mode]
install_browser_monitoring(rails_config)
end
end
@@ -59,13 +56,13 @@
@browser_monitoring_installed = true
return if config.nil? || !config.respond_to?(:middleware) || !Agent.config[:'browser_monitoring.auto_instrument']
begin
require 'new_relic/rack/browser_monitoring'
config.middleware.use NewRelic::Rack::BrowserMonitoring
- log!("Installed New Relic Browser Monitoring middleware", :info)
+ ::NewRelic::Agent.logger.debug("Installed New Relic Browser Monitoring middleware")
rescue => e
- log!("Error installing New Relic Browser Monitoring middleware: #{e.inspect}", :error)
+ ::NewRelic::Agent.logger.warn("Error installing New Relic Browser Monitoring middleware: #{e.inspect}")
end
end
def install_developer_mode(rails_config)
return if @installed
@@ -77,36 +74,18 @@
# inform user that the dev edition is available if we are running inside
# a webserver process
if @local_env.dispatcher_instance_id
port = @local_env.dispatcher_instance_id.to_s =~ /^\d+/ ? ":#{local_env.dispatcher_instance_id}" : ":port"
- log!("NewRelic Agent Developer Mode enabled.")
- log!("To view performance information, go to http://localhost#{port}/newrelic")
+ ::NewRelic::Agent.logger.debug("NewRelic Agent Developer Mode enabled.")
+ ::NewRelic::Agent.logger.debug("To view performance information, go to http://localhost#{port}/newrelic")
end
rescue => e
- log!("Error installing New Relic Developer Mode: #{e.inspect}", :error)
+ ::NewRelic::Agent.logger.warn("Error installing New Relic Developer Mode: #{e.inspect}")
end
elsif rails_config
- log!("Developer mode not available for Rails versions prior to 2.2", :warn)
+ ::NewRelic::Agent.logger.warn("Developer mode not available for Rails versions prior to 2.2")
end
- end
-
- def log!(msg, level=:info)
- if should_log?
- logger = ::Rails.respond_to?(:logger) ? ::Rails.logger : ::RAILS_DEFAULT_LOGGER
- logger.send(level, msg)
- else
- super
- end
- rescue => e
- super
- end
-
- def to_stdout(message)
- logger = ::Rails.respond_to?(:logger) ? ::Rails.logger : ::RAILS_DEFAULT_LOGGER
- logger.info(message)
- rescue => e
- super
end
def rails_version
@rails_version ||= NewRelic::VersionNumber.new(::Rails::VERSION::STRING)
end