Skip to content Skip to sidebar Skip to footer

Logging Does Not Show The Result Of Array

Software Django 1.9 Python 3.4 What did I do? I have the following Django code in my views.py from django.db import connection cursor = connection.cursor() cursor.execute

Solution 1:

You might need to set logging.basicConfig(level=logging.INFO) before you call logging.getLogger(__name__).

You can check out the Logging Cookbook for a detailed guide.

Solution 2:

I belive that what you are seeing are actually logs from django.db.backends, checkout this reference.

Messages relating to the interaction of code with the database. For example, every application-level SQL statement executed by a request is logged at the DEBUG level to this logger.

Messages to this logger have the following extra context:

duration: The time taken to execute the SQL statement. sql: The SQL statement that was executed. params: The parameters that were used in the SQL call. For performance reasons, SQL logging is only enabled when settings.DEBUG is set to True, regardless of the logging level or handlers that are installed.

This logging does not include framework-level initialization (e.g. SET TIMEZONE) or transaction management queries (e.g. BEGIN, COMMIT, and ROLLBACK). Turn on query logging in your database if you wish to view all database queries.

You are logging with level log level info meanwhile django.db.backends logs at DEBUG level so checkout also your log handlers to be sure what you are actually logging and what you are not :)

Hope it helps!

Post a Comment for "Logging Does Not Show The Result Of Array"