Log message augmentation #50

Closed
kylev opened this Issue Aug 17, 2011 · 7 comments

Comments

Projects
None yet
4 participants

kylev commented Aug 17, 2011

This is my favorite feature from db-charmer that is missing in octopus. When a query happens on a DB other than master, the debug log contains a prefix in dark blue that tells me which DB was used. The relevant function is here:

https://github.com/kovyrin/db-charmer/blob/master/lib/db_charmer/abstract_adapter/log_formatting.rb

It would be wonderful if octopus also did this.

kylev commented Aug 17, 2011

Note: I am using octopus with 0.3.4 with Rails 2.3.12.

+1. It doesn't look like 0.4.0 is compatible with rails2.x as the gemspec states that it requires active_record "= 3.0.6". I think the fix requires two changes. 1) The latest version of Octopus should run with 2.x. It appears master already has done this, so awesome. 2) The logger needs to be ported to work with ActiveRecord 2.x using the api stated in the premier comment. Anyway yo thanks.

Owner

thiagopradi commented Aug 18, 2011

Hi @kylev and @growlypants,

Octopus already has a logger (https://github.com/tchandy/octopus/wiki/Logger). but I personally think that it should to be improved, I prefer the log formatting from db-charmer.

Also, @growlypants, Octopus should be compatible with Rails 2.x. maybe the gemspec is wrong.

Also, patches are welcome for both of cases.

Thanks,

Thiago

@tchandy thank you for you kind response. I always appreciate thankful messages. I believe the gemspec is wrong on version 0.4.0 (https://github.com/tchandy/octopus/blob/v0.4.0/ar-octopus.gemspec). It states s.add_runtime_dependency(%q, ["= 3.0.6"]) which requires rails 3. I'll continue look into the logger, but I can't fully investigate until we're on rails 3.

@tchandy this is the commit which removes the hard dependency on ar 3: e8114af and a new gem version has not been published with that gemspec.

kylev commented Mar 21, 2012

The db-charmer guy has updated his idiom for shard/slave identification in rails3 land. It might be super-easy to implement now.

https://github.com/kovyrin/db-charmer/blob/master/lib/db_charmer/rails3/active_record/log_subscriber.rb

Collaborator

sobrinho commented Sep 8, 2012

This is already implemented on octopus master, i.e.:

[Shard: canada]   (0.3ms)  SELECT COUNT(*) FROM `orders` WHERE `orders`.`account_id` = 1

I'm going to close this issue ;)

sobrinho closed this Sep 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment