Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

7

How can I log all SQL queries to a file?

By
Alexandre Fayolle - Camptocamp
on 2/11/13, 10:27 AM 6,868 views

Is there a logging configuration enabling the logging of all SQL queries issued by OpenERP to a file?

Do you specifically not want to do this in the database?

Martin
on 2/11/13, 10:31 AM

good question... It sometimes happen that I have access to the openerp config, but not as easily to the postgresql config (need to file a request to a DBA...), so something on the openerp side is preferred.

Camptocamp France SAS, Alexandre Fayolle - Camptocamp
on 2/11/13, 10:43 AM
9

Nicolas Vanhoren (niv)

--Nicolas Vanhoren (niv)--
1144
| 0 0 0
--Nicolas Vanhoren (niv)--
Nicolas Vanhoren (niv)
On 2/11/13, 10:36 AM

OpenERP does not provide a mechanism specifically to log SQL queries, but it has a generic logging feature. By adding --log-level=debug_sql to the command line used to launch OpenERP it will print the normal debugging messages + the sql commands. You can redirect that output to a file if you want.

You could also configure PostgreSQL to log the queries. I would personally prefer that solution if the goal is to optimize the database usage.

my immediate goat is tracing a change, without installing the audit_trail addon. But I left the question generic since there are many cases in which this can be useful.

Camptocamp France SAS, Alexandre Fayolle - Camptocamp
on 2/11/13, 10:45 AM

You can use the new auto-track feature of v7. Check _track on the object or the track_visibility attribute on fields. Example on Opportunities; if you change the value of some fields: responsible, expected revenue... it's automatically logged in open chatter (and user can follow some actions)

Fabien Pinckaers (fp)
on 2/11/13, 2:41 PM

but where is the _track or track_visibility attibute?how to set them?

Xinwen Li
on 3/16/13, 9:05 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/11/13, 10:27 AM
Seen: 6868 times
Last updated: 3/16/15, 8:10 AM