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
parent
commit
5c9fa027b8
No known key found for this signature in database GPG Key ID: BCAB2555446B5B92
  1. 2
      slow_statement_logger/__init__.py
  2. 7
      slow_statement_logger/readme/USAGE.rst

2
slow_statement_logger/__init__.py

@ -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"),

7
slow_statement_logger/readme/USAGE.rst

@ -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.
Loading…
Cancel
Save