lulalala / multi_logger

Create multiple loggers in Rails
MIT License
59 stars 21 forks source link

Log not registering in production #11

Open alfo opened 10 years ago

alfo commented 10 years ago

In development, everything works as expected. However, when I deploy to a Dokku instance, I have a problem that the method is not added to Logger.

Steps to reproduce (rails console production):

MultiLogger.add_logger('xxx')
=> #<Logger:0x007f935d1ce038 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007f935d1ce010 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007f935d1cdfc0 @shift_size=1048576, @shift_age=0, @filename="/app/log/xxx.log", @dev=#<File:/app/log/xxx.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007f935d1cdf98 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007f935d1cdf48>>>>

Rails.logger.xxx.info "Something"
=> NoMethodError: undefined method `xxx' for #<Logger:0x007f935de0d1f0>

The log file log/xxx.log is created in production, but nothing is written to it other than

# Logfile created on 2014-08-07 08:20:42 +0000 by logger.rb/44203

Any ideas?

lulalala commented 10 years ago

I can't reproduce this in production. Can you give your Rails version and run the following in console?

puts MultiLogger.get_rails_logger_class
puts Rails.logger
kyledcline commented 9 years ago

@lulalala Not OP, but I am having the same issue when deploying to a Heroku instance on Rails 4.1.7.

puts MultiLogger.get_rails_logger_class
ActiveSupport::Logger
=> nil

puts Rails.logger
#<Logger:0x007f13e617fcb8>
=> nil
Jedidiah commented 8 years ago

+1 Also not the OP, but having the same problem (works in development but not production) and getting the same output as @kyledcline when putting the values you asked for.

Using Rails 4.2.3 and Ruby 2.1.6p336

Edit, should say this isn't a Heroku instance, I'm just deploying to a Centos server.