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

config.sequel.logger is nil in environment.rb #98

Closed
stevenringo opened this issue Oct 2, 2015 · 2 comments
Closed

config.sequel.logger is nil in environment.rb #98

stevenringo opened this issue Oct 2, 2015 · 2 comments

Comments

@stevenringo
Copy link

Hi,

I am trying to configure sequel-rails in various environments to log to a separate logfile from rails's.

Following the pattern of ActiveRecord, where one would put a line like this into an environment config file:

config.active_record.logger = nil

I am trying:

Rails.application.configure do
  config.cache_classes  = false
  ...
  ...
  config.sequel.logger  = SomeSpecialLogger.new(STDOUT)
end

In this block config.sequel.logger seems to be nil anyway (I am somehow expecting it to be assigned), and assigning it here seems to be overwritten later.

Either I am doing something wrong, or sequel-rails is not designed to have a logger set at this point in the rails initialization process. I do seem to be apple to apply a different logger in an initializer, like this:

SequelRails.configuration.logger = Logger.new(STDOUT)

However that would then apply to all environments.

Can anyone advise what is the best way to assign a different logger per environment?

@JonathanTron
Copy link
Member

Hi @stevenringo, thanks for reporting the problem.

You're right that sequel.config.logger value is overwritten (this happens in https://github.com/TalentBox/sequel-rails/blob/master/lib/sequel_rails/railtie.rb#L56-L58).

This is a bug.

@stevenringo
Copy link
Author

Thanks for the fix! Much appreciated.

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