Browse Source
slow_statement_logger: log with debug level
This is effectively a debugging information and logging
with a warning level would create too much noise in
log capture systems such as Sentry.
12.0-mig-module_prototyper_last
Stéphane Bidoul (ACSONE)
5 years ago
No known key found for this signature in database
GPG Key ID: BCAB2555446B5B92
2 changed files with
6 additions and
3 deletions
-
slow_statement_logger/__init__.py
-
slow_statement_logger/readme/USAGE.rst
|
|
@ -28,7 +28,7 @@ class SlowStatementLoggingCursor(sql_db.Cursor): |
|
|
|
if duration >= LOG_MIN_DURATION_STATEMENT: |
|
|
|
# same logging technique as Odoo in sql_log mode |
|
|
|
encoding = psycopg2.extensions.encodings[self.connection.encoding] |
|
|
|
_logger.warning( |
|
|
|
_logger.debug( |
|
|
|
"duration: %.3f ms statement: %s", |
|
|
|
duration, |
|
|
|
self._obj.mogrify(query, params).decode(encoding, "replace"), |
|
|
|
|
|
@ -3,8 +3,11 @@ Add ``slow_statement_logger`` to Odoo's ``--load`` command line option, or to th |
|
|
|
|
|
|
|
Add a ``log_min_duration_statement`` entry in the ``options`` section of your |
|
|
|
Odoo configuration file. Statements running at least this number of |
|
|
|
milliseconds will be logged with a *warning* level in the |
|
|
|
``odoo.addons.slow_statement_logger`` handler. ``0`` means all statements will be |
|
|
|
milliseconds will be logged with a *debug* level in the |
|
|
|
``odoo.addons.slow_statement_logger`` logger. ``0`` means all statements will be |
|
|
|
logged. ``-1`` disables this logging. You can also set an environment variable |
|
|
|
``ODOO_LOG_MIN_DURATION_STATEMENT`` which will have priority over the |
|
|
|
configuration file entry. |
|
|
|
|
|
|
|
Add ``odoo.addons.slow_statement_logger:DEBUG`` in your ``log_handler`` |
|
|
|
configuration file entry or ``--log-handler`` command line option. |