Reputation: 4950
What's the redis equivalent of ActiveRecord::Base.logger = Logger.new(STDOUT)
? I want to see what redis is up to.
Upvotes: 9
Views: 3238
Reputation: 111
I wrote a gem call RedisLogger:
https://github.com/hellolucky/redis_logger
Upvotes: 1
Reputation:
I usually want to set some additional attributes (such as the redis DB name). You can pass on arguments in the initialize method like this
$redis = Redis.new(db: Rails.config.redis.db, logger: Rails.logger)
Upvotes: 7
Reputation: 4950
Never mind. It's easy:
$redis = Redis.new(:host => 'localhost', :port => 6379)
$redis.client.logger = Logger.new(STDOUT)
Upvotes: 1