0

我正在尝试将 log4r 与 rails 4 和 neo4j 一起使用。我有带有活动记录的 log4r,它工作正常,但我无法让它与 neo4j 一起工作。我认为的主要问题是对于 neo4j 不可用的记录器方法。我正在使用 gem "neo4j"、"3.0.0.alpha.7" gem 和 "log4r"、"1.1.10"。

错误:

config/application.rb:59:in `<class:Application>': undefined method `logger=' for     Neo4j::ActiveNode:Module (NoMethodError)

这是上的代码:

应用程序.rb

require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
  require "active_model/railtie"
  require "action_controller/railtie"
  require "action_mailer/railtie"
  require "action_view/railtie"
  require "sprockets/railtie"
  require 'neo4j/railtie'
  require "rails/test_unit/railtie"
  require 'rails/all'
  require 'log4r'
  require 'yaml'
  require 'log4r/yamlconfigurator'
  require 'log4r/outputter/datefileoutputter'
  include Log4r


  # Require the gems listed in Gemfile, including any gems
  # you've limited to :test, :development, or :production.
  Bundler.require(*Rails.groups)

  module NewClarity
  class Application < Rails::Application

  config.generators do |g|
    g.orm             :neo4j
  end

  config.neo4j.session_type = :server_db 
  config.neo4j.session_path = 'http://localhost:7474'


  log4r_config= YAML.load_file(File.join(File.dirname(__FILE__),"log4r.yml"))
  log_cfg = YamlConfigurator
  log_cfg.decode_yaml( log4r_config['log4r_config'] )

  log = Log4r::Logger['rails']
 #config.logger = Log4r::Logger['rails']
  Neo4j::ActiveNode.logger = Log4r::Logger['rails'] 
  config.log_level = :unknown
 end
end
4

1 回答 1

0

目前 3.0.x 版本中没有日志记录支持,但我在上面添加了一个 github 问题https://github.com/andreasronge/neo4j/issues/374

于 2014-07-11T07:50:47.673 回答