colbygk/log4r

undefined method `formatter' for Log4r::Logger in Rails?

solars opened this issue · 5 comments

Hi there,

I'm getting the following error: https://gist.github.com/solars/5af4e6743ac301a2ecdc
when trying to run a rails project with log4r locally in production mode - somehow I don't get it with passenger on the server, not sure why.

It seems as if rails expects a formatter method somewhere else than log4r has it, versions are:
log4r (1.1.10)
rails (4.0.13)

Since I don't want to risk breaking the app, is there a fix/workaround for this in later versions? Or is it something else?

Thanks a lot,
Christoph

@solars did you happen to resolve this issue? I'm getting it in development as well, rails 4.2.1, though strangely only when using webrick as the server--with unicorn, it works fine. EDIT: same issue with thin as rails server.

Don't see much activity here anymore, have you tried Semantic Logger?
The rails_semantic_logger gem directly replaces the Rails logger and patches out the formatter calls.

@lukeasrodgers sorry, I must have missed your question - I did resolve it, but I cannot remember how. In case you still have issues I could try to find it though.

I'm still using log4r without problems.

@solars, no worries. We are still using it as well, and it works alright, though we have to jump around some hoops to initialize it correctly (rails 3.2), and Graylog doesn't seem to correctly be able to extract level information from its output. Not sure if that is an issue with our log4r setup, or Graylog. @solars have you run into the same/similar issue, out of curiousity?

@lukeasrodgers
The logger is in a separate gem at the moment (in a singleton class).
I'm initializing it in config/environment.rb and then inside config/environments/production.rb I just do config.logger = MyGem::Logger.instance.log (which is the log4r logger).

Not sure if it's a good way but it works :)