# Migration : mÃ©thode execute couper les logs

**URL:** <https://www.ruby-forum.com/t/migration-ma-thode-execute-couper-les-logs/170363>\
**Category:** FR\
**Created:** [June 16, 2009, 5:21pm UTC](https://www.ruby-forum.com/t/migration-ma-thode-execute-couper-les-logs/170363 "2009-06-16T17:21:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zdavidlnx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/839c29/32.png) [@zdavidlnx](https://www.ruby-forum.com/u/zdavidlnx)\
**Post date:** [June 16, 2009, 5:21pm UTC](https://www.ruby-forum.com/t/migration-ma-thode-execute-couper-les-logs/170363/1 "2009-06-16T17:21:43Z")

</div>

J’ai une migration qui effectue un grand nombre de requÃªtes SQL.  
J’utilise pour chacune d’entre elles la mÃ©thode execute.  
Le problÃ¨me est que cette mÃ©thode affiche dans la console toutes les  
requÃªtes effectuÃ©es en base de donnÃ©es.  
Est-il possible de ne pas afficher ces sorties?

Merci

David Gautier

---

<div class="post-metadata">

**Author:** ![zdavidlnx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/839c29/32.png) [@zdavidlnx](https://www.ruby-forum.com/u/zdavidlnx)\
**Post date:** [June 17, 2009, 9:18am UTC](https://www.ruby-forum.com/t/migration-ma-thode-execute-couper-les-logs/170363/2 "2009-06-17T09:18:21Z")

</div>

Hello,

peut-être que changer le niveau de log juste avant ta migration fera  
l’affaire ?

> <https://stackoverflow.com/questions/946101/disabling-rails-logging-from-script-runner>

– Thibaut

---

<div class="post-metadata">

**Author:** ![zdavidlnx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/839c29/32.png) [@zdavidlnx](https://www.ruby-forum.com/u/zdavidlnx)\
**Post date:** [June 18, 2009, 11:00am UTC](https://www.ruby-forum.com/t/migration-ma-thode-execute-couper-les-logs/170363/3 "2009-06-18T11:00:58Z")

</div>

> Â Â ActiveRecord::Schema.verbose = false

sympa - je connaissais pas. Merci!

– Thibaut

---

<div class="post-metadata">

**Author:** ![zdavidlnx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/839c29/32.png) [@zdavidlnx](https://www.ruby-forum.com/u/zdavidlnx)\
**Post date:** [June 17, 2009, 2:12pm UTC](https://www.ruby-forum.com/t/migration-ma-thode-execute-couper-les-logs/170363/4 "2009-06-17T14:12:55Z")

</div>

Merci pour ta rÃ©ponse,

Cette mÃ©thode n’a pas fonctionnÃ©, cependant j’ai trouvÃ© une solution:

class MaMigration \< ActiveRecord::Migration  
def self.up  
ActiveRecord::Schema.verbose = false  
…migration…  
ActiveRecord::Schema.verbose = true  
end

def self.down  
ActiveRecord::Schema.verbose = false  
…annulation…  
ActiveRecord::Schema.verbose = true  
end  
end

[http://www.ruby-forum.com/topic/167716](http://www.ruby-forum.com/topic/167716)

Si ActiveRecord::Schema.verbose vaut false la methode execute n’affiche  
plus les requÃªtes dans la console

Merci encore

– David
