lib/semantic_logger/railtie.rb in semantic_logger-0.0.2 vs lib/semantic_logger/railtie.rb in semantic_logger-0.1.0
- old
+ new
@@ -7,11 +7,11 @@
#
# Claritybase::Application.configure do
# # Add the MongoDB logger appender only once Rails is initialized
# config.after_initialize do
# config.semantic_logger.appenders << SemanticLogger::Appender::Mongo.new(
- # :db => Cache::Work.db
+ # :db => Mongo::Connection.new['development_development']
# )
# end
# end
config.semantic_logger = ::SemanticLogger::Logger
@@ -23,9 +23,13 @@
#
# Loaded after Rails logging is initialized since SemanticLogger will continue
# to forward logging to the Rails Logger
initializer :initialize_semantic_logger, :after => :initialize_logger do
config = Rails.application.config
+
+ # First set the internal logger to the one used by Rails in case something goes wrong
+ # with an appender
+ SemanticLogger::Logger.logger = Rails.logger
# Add the Rails Logger to the list of appenders
SemanticLogger::Logger.appenders << SemanticLogger::Appender::Logger.new(Rails.logger)
# Set the default log level based on the Rails config