-- if (($0 == 'irb' || $0 == 'jirb') && ENV['RAILS_CONSOLE_STDOUT']) || ENV['RAILS_LOGGER_STDOUT'] -- config.logger = Logger.new(STDOUT) -- end ++ # Setup Semantic Logging ++# require 'lib/semantic_logger' ++# if (($0 == 'irb' || $0 == 'jirb') && ENV['RAILS_CONSOLE_STDOUT']) || ENV['RAILS_LOGGER_STDOUT'] ++# config.logger = SemanticLogger::LoggerAppender.new(Logger.new(STDOUT)) ++# else ++# exc = nil ++# begin ++# # Don't use Mongo Log Appender in dev and test ++# unless false #Rails.env.test? #or Rails.env.development? ++# require 'mongo' ++# require 'lib/auto_failover_repl_set_connection' ++# # Log only to Mongo ++# cfg = YAML.load_file(File.join(Rails.root, "config", "mongo.yml"))[Rails.env] ++# conn = Mongo::AutoFailoverReplSetConnection.from_uri(cfg['uri'],cfg['options'] || {}) ++# SemanticLogger::MongoAppender.db = conn.db("logger_#{Rails.env}") ++# SemanticLogger::MongoAppender.create_indexes ++# config.logger = SemanticLogger::MongoAppender.new('Rails', config.log_level) ++# end ++# rescue StandardError => exc ++# end ++# ++# begin ++# unless config.logger ++# # Wrap the BufferedLogger with the Semantic Logger ++# logger = ActiveSupport::BufferedLogger.new(config.log_path) ++# logger.level = ActiveSupport::BufferedLogger.const_get(config.log_level.to_s.upcase) ++# logger.auto_flushing = false if config.environment == "production" ++# config.logger = SemanticLogger::LoggerAppender.new(logger) ++# config.logger.error("Failed to start Mongo Logger, falling back to File Logging", exc) if exc ++# end ++# rescue StandardError => exc ++# end ++# ++# unless config.logger ++# config.logger = ActiveSupport::BufferedLogger.new(STDERR) ++# config.logger.level = ActiveSupport::BufferedLogger::WARN ++# config.logger.error("Failed to start SemanticLogger::LoggerAppender") ++# config.logger.error(exc) if exc ++# config.logger.warn( ++# "Rails Error: Unable to access log file. Please ensure that #{config.log_path} exists and is chmod 0666. " + ++# "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed." ++# ) ++# end ++ ++ # Rails.logger = ++# def initialize_framework_logging ++# for framework in ([ :active_record, :action_controller, :action_mailer ] & configuration.frameworks) ++# framework.to_s.camelize.constantize.const_get("Base").logger ||= Rails.logger ++# end ++# ++# ActiveSupport::Dependencies.logger ||= Rails.logger ++# Rails.cache.logger ||= Rails.logger ++# end ++ ++ ++# end