Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger handles '-' in filename by replacing it with '_' #5

Open
davidchua opened this issue Mar 18, 2014 · 2 comments
Open

Logger handles '-' in filename by replacing it with '_' #5

davidchua opened this issue Mar 18, 2014 · 2 comments

Comments

@davidchua
Copy link

When attempting to create a logger name 'omniauth-failure' in my config/initializer/logger.rb like:

MultiLogger.add_logger('omniauth-failure')

and then adding a logging command in my controller like:

def some_action
  logger.omniauth-failure.debug('error logged')
end

I'll get a NoMethodError when accessing the action.

NoMethodError (undefined method 'omniauth' for #<ActiveSupport::Logger:...........

A further investigation in my log/ directory shows that a file 'omniauth_failure.log' was created instead of 'omniauth-failure.log'.

@lulalala
Copy link
Owner

Since in Ruby you can't have dash/minus sign in method name, you can't access it. (I guess you can do a logger.send(:'omniauth-failure')). I guess I'll raise some warning. Meanwhile you can just switch to underscore naming.

@davidchua
Copy link
Author

Thanks! That certainly would work.

Just thought I raise this issue up as well in case others experience the same thing and wonder what went wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants