3

When trying to create a new ruby logger:

logger = Logger.new('my.log')

I'm getting an error:

NoMethodError: undefined method `new' for HTTParty::Logger:Module

Creating the logger from the Rails Console works fine. When trying to create it from the class is when it's getting the error. It appears that HTTParty is interfering with it. How do I specify that I wish to use the stdlib Logger instead of the gem HTTParty's Logger?

singularity
  • 573
  • 4
  • 15

1 Answers1

4

If you want to get the constant in 'root' namespace, you can use :: operator, like this:

logger = ::Logger.new('my.log')
Marek Lipka
  • 50,622
  • 7
  • 87
  • 91