lib/semantic_logger/railtie.rb in semantic_logger-0.11.1 vs lib/semantic_logger/railtie.rb in semantic_logger-0.11.2
- old
+ new
@@ -1,5 +1,6 @@
+require 'logger'
module SemanticLogger #:nodoc:
class Railtie < Rails::Railtie #:nodoc:
# Make the SemanticLogger config available in the Rails application config
#
# Example: Add the MongoDB logging appender in the Rails environment
@@ -38,14 +39,15 @@
FileUtils.mkdir_p File.dirname path
end
# Set internal logger to log to file only, in case another appender
# experiences logging problems
- SemanticLogger::Logger.logger = SemanticLogger::Appender::File.new(path)
+ appender = SemanticLogger::Appender::File.new(path)
+ appender.name = "SemanticLogger::Logger"
+ SemanticLogger::Logger.logger = appender
# Add the log file to the list of appenders
SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new(path)
-
SemanticLogger::Logger.new(Rails)
rescue StandardError
# If not able to log to file, log to standard error with warning level only
SemanticLogger::Logger.default_level = :warn