Open DannyBen opened 8 years ago
I am guessing this is like #8 I guess the way to do it is to detect the usage of https://github.com/heroku/rails_stdout_logging, and then add the accessor methods on it, and point it to stdout. Would you mind tackling it? Because I don't use Heroku myself :P
I can try
Update: So far I was unable to figure out an elegant way to do what I want.
My thoughts are these:
A. If making any addition or update to multi_logger, it should be a more generic patch rather than a fix for Heroku. Based on this, I was considering having a setting in multi_logger to say "use tagged mode" - and then, people can do something like:
# config/initializers/multi_logger.rb
MultiLogger.tagged_mode = Rails.env.production? # or whatever logic suits them
B. Then, in "tagged mode", any call to Rails.logger.notifier.info "hello"
would simply log to the standard, untouched logger, and only prefix it with the name - like "[:notifier] hello"
I spent some time on this, but was unable to come up with anything nice. For now, I am doing this ugly thing:
if Rails.env.production?
Rails.logger.info "[:notifier] #{msg}"
else
Rails.logger.notifier.info msg
end
I may try again, or stay with this workaround, or look for another approach. I am open to any nudge in the right direction so that either me or someone else can implement it.
Hello,
I am working with multi logger for quite some time in development, and in production, and it works nicely and I cant live without it... :)
I am experiencing a weird problem in production, that seems to be related to a Heroku's way of handling logging.
When translated to English, the suspected error says: RailsStdoutLogging does not know any of the multi-logger logs
I have a log named
notifier
defined withAnd the error log says:
I found this SO post that may be related. It seems (not verified) that Heroku forces stdout logging, so my guess is that all my multi logger calls will fail unless there is support or at least graceful handling of this case. Thoughts? Am I doomed and need to abandon my multi logging?...
I also opened a ticket on Heroku, and will post back here with any results.