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
Errors when Dynamoid.logger is nil #404
Comments
Thank you for the report. Actually I didn't manage to reproduce the issue with new Rails application. Could you provide steps to reproduce the issue? (Note I copied your Dynamoid configuration to an initializer). https://github.com/andrykonchin/dynamoid-reproduce-logger-issue The issue is very interesting because there is a default value - |
@andrykonchin I'll try to reproduce this when I get a moment. Perhaps this is an idiosyncrasy with Ruby on Jets (while similar to rails and using most rails modules, it's possible it behaves differently in this regard). It's very possible Jets lacks the same NullLogger fallback behaviour, and that this would be more appropriate to be addressed there instead of forcing Jets specific Dynamoid changes here. I'll try and come back with some clarity but it's possible this might just end up being an upstream Jets change and/or some documentation change about requiring a Logger in exotic environments/use-cases. |
Setting a logger for Dynamoid to prevent errors when executing rake tasks (see Dynamoid/dynamoid#404)
It seems there is a potential bug when the logger is not configured. The context for how I inadvertently had no logger configured is trying to use Dynamoid alongside Ruby on Jets, however I do not know how important this is. I had a configuration block
Which lacks a
config.logger
. This was resulting in errors:rake dynamodb:ping
rake dynamodb:create_tables
Upon investigation these reference Dynamoid.logger, which can be nil.
Would it be possible to either:
Dynamoid.logger
toDynamoid&.logger&.debug(...)
(Ruby 2.3+),Dynamoid.try(:logger).try(:debug, ...)
(ActiveSupport) or with a presence check (if Dynamoid.logger ...
)In addition, it might be nicer to output the stacktrace as part of the
ping
command - this lead to some additional confusion before I triedcreate_tables
.The text was updated successfully, but these errors were encountered: