{"title":"Logging","version":"1.11","locale":"pl","docname":"topics/logging","url":"/pl/1.11/topics/logging/","canonical":"https://djangodocs.dev/pl/1.11/topics/logging/","summary":"A quick logging primer Link to this heading # Django uses Python’s builtin logging module to perform system logging. The usage of this module is discussed in detail…","html":"<span id=\"logging\"></span><h1>Logging<a class=\"heading-anchor\" href=\"#module-django.utils.log\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"a-quick-logging-primer\">\n<h2>A quick logging primer<a class=\"heading-anchor\" href=\"#a-quick-logging-primer\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django uses Python’s builtin <a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.html#module-logging\" title=\"(w Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">logging</span></code></a> module to perform system logging.\nThe usage of this module is discussed in detail in Python’s own documentation.\nHowever, if you’ve never used Python’s logging framework (or even if you have),\nhere’s a quick primer.</p>\n<section id=\"the-cast-of-players\">\n<h3>The cast of players<a class=\"heading-anchor\" href=\"#the-cast-of-players\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A Python logging configuration consists of four parts:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"#topic-logging-parts-loggers\"><span class=\"std std-ref\">Loggers</span></a></p></li>\n<li><p><a class=\"reference internal\" href=\"#topic-logging-parts-handlers\"><span class=\"std std-ref\">Handlers</span></a></p></li>\n<li><p><a class=\"reference internal\" href=\"#topic-logging-parts-filters\"><span class=\"std std-ref\">Filtry</span></a></p></li>\n<li><p><a class=\"reference internal\" href=\"#topic-logging-parts-formatters\"><span class=\"std std-ref\">Formatters</span></a></p></li>\n</ul>\n<section id=\"loggers\">\n<span id=\"topic-logging-parts-loggers\"></span><h4>Loggers<a class=\"heading-anchor\" href=\"#loggers\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>A logger is the entry point into the logging system. Each logger is\na named bucket to which messages can be written for processing.</p>\n<p>A logger is configured to have a <em>log level</em>. This log level describes\nthe severity of the messages that the logger will handle. Python\ndefines the following log levels:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code>: Low level system information for debugging purposes</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code>: General system information</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">WARNING</span></code>: Information describing a minor problem that has\noccurred.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code>: Information describing a major problem that has\noccurred.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">CRITICAL</span></code>: Information describing a critical problem that has\noccurred.</p></li>\n</ul>\n<p>Each message that is written to the logger is a <em>Log Record</em>. Each log\nrecord also has a <em>log level</em> indicating the severity of that specific\nmessage. A log record can also contain useful metadata that describes\nthe event that is being logged. This can include details such as a\nstack trace or an error code.</p>\n<p>When a message is given to the logger, the log level of the message is\ncompared to the log level of the logger. If the log level of the\nmessage meets or exceeds the log level of the logger itself, the\nmessage will undergo further processing. If it doesn’t, the message\nwill be ignored.</p>\n<p>Once a logger has determined that a message needs to be processed,\nit is passed to a <em>Handler</em>.</p>\n</section>\n<section id=\"handlers\">\n<span id=\"topic-logging-parts-handlers\"></span><h4>Handlers<a class=\"heading-anchor\" href=\"#handlers\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The handler is the engine that determines what happens to each message\nin a logger. It describes a particular logging behavior, such as\nwriting a message to the screen, to a file, or to a network socket.</p>\n<p>Like loggers, handlers also have a log level. If the log level of a\nlog record doesn’t meet or exceed the level of the handler, the\nhandler will ignore the message.</p>\n<p>A logger can have multiple handlers, and each handler can have a\ndifferent log level. In this way, it is possible to provide different\nforms of notification depending on the importance of a message. For\nexample, you could install one handler that forwards <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> and\n<code class=\"docutils literal notranslate\"><span class=\"pre\">CRITICAL</span></code> messages to a paging service, while a second handler\nlogs all messages (including <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">CRITICAL</span></code> messages) to a\nfile for later analysis.</p>\n</section>\n<section id=\"filters\">\n<span id=\"topic-logging-parts-filters\"></span><h4>Filtry<a class=\"heading-anchor\" href=\"#filters\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>A filter is used to provide additional control over which log records\nare passed from logger to handler.</p>\n<p>By default, any log message that meets log level requirements will be\nhandled. However, by installing a filter, you can place additional\ncriteria on the logging process. For example, you could install a\nfilter that only allows <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> messages from a particular source to\nbe emitted.</p>\n<p>Filters can also be used to modify the logging record prior to being\nemitted. For example, you could write a filter that downgrades\n<code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> log records to <code class=\"docutils literal notranslate\"><span class=\"pre\">WARNING</span></code> records if a particular set of\ncriteria are met.</p>\n<p>Filters can be installed on loggers or on handlers; multiple filters\ncan be used in a chain to perform multiple filtering actions.</p>\n</section>\n<section id=\"formatters\">\n<span id=\"topic-logging-parts-formatters\"></span><h4>Formatters<a class=\"heading-anchor\" href=\"#formatters\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Ultimately, a log record needs to be rendered as text. Formatters\ndescribe the exact format of that text. A formatter usually consists\nof a Python formatting string containing\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.html#logrecord-attributes\" title=\"(w Python v3.14)\"><span class=\"xref std std-ref\">LogRecord attributes</span></a>; however,\nyou can also write custom formatters to implement specific formatting behavior.</p>\n</section>\n</section>\n</section>\n<section id=\"using-logging\">\n<h2>Using logging<a class=\"heading-anchor\" href=\"#using-logging\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Once you have configured your loggers, handlers, filters and\nformatters, you need to place logging calls into your code. Using the\nlogging framework is very simple. Here’s an example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"c1\"># import the logging library</span>\n<span class=\"kn\">import</span><span class=\"w\"> </span><span class=\"nn\">logging</span>\n\n<span class=\"c1\"># Get an instance of a logger</span>\n<span class=\"n\">logger</span> <span class=\"o\">=</span> <span class=\"n\">logging</span><span class=\"o\">.</span><span class=\"n\">getLogger</span><span class=\"p\">(</span><span class=\"vm\">__name__</span><span class=\"p\">)</span>\n\n<span class=\"k\">def</span><span class=\"w\"> </span><span class=\"nf\">my_view</span><span class=\"p\">(</span><span class=\"n\">request</span><span class=\"p\">,</span> <span class=\"n\">arg1</span><span class=\"p\">,</span> <span class=\"n\">arg</span><span class=\"p\">):</span>\n    <span class=\"o\">...</span>\n    <span class=\"k\">if</span> <span class=\"n\">bad_mojo</span><span class=\"p\">:</span>\n        <span class=\"c1\"># Log an error message</span>\n        <span class=\"n\">logger</span><span class=\"o\">.</span><span class=\"n\">error</span><span class=\"p\">(</span><span class=\"s1\">&#39;Something went wrong!&#39;</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>And that’s it! Every time the <code class=\"docutils literal notranslate\"><span class=\"pre\">bad_mojo</span></code> condition is activated, an\nerror log record will be written.</p>\n<section id=\"naming-loggers\">\n<h3>Naming loggers<a class=\"heading-anchor\" href=\"#naming-loggers\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The call to <a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.html#logging.getLogger\" title=\"(w Python v3.14)\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">logging.getLogger()</span></code></a> obtains (creating, if\nnecessary) an instance of a logger. The logger instance is identified\nby a name. This name is used to identify the logger for configuration\npurposes.</p>\n<p>By convention, the logger name is usually <code class=\"docutils literal notranslate\"><span class=\"pre\">__name__</span></code>, the name of\nthe python module that contains the logger. This allows you to filter\nand handle logging calls on a per-module basis. However, if you have\nsome other way of organizing your logging messages, you can provide\nany dot-separated name to identify your logger:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"c1\"># Get an instance of a specific named logger</span>\n<span class=\"n\">logger</span> <span class=\"o\">=</span> <span class=\"n\">logging</span><span class=\"o\">.</span><span class=\"n\">getLogger</span><span class=\"p\">(</span><span class=\"s1\">&#39;project.interesting.stuff&#39;</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>The dotted paths of logger names define a hierarchy. The\n<code class=\"docutils literal notranslate\"><span class=\"pre\">project.interesting</span></code> logger is considered to be a parent of the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">project.interesting.stuff</span></code> logger; the <code class=\"docutils literal notranslate\"><span class=\"pre\">project</span></code> logger\nis a parent of the <code class=\"docutils literal notranslate\"><span class=\"pre\">project.interesting</span></code> logger.</p>\n<p>Why is the hierarchy important? Well, because loggers can be set to\n<em>propagate</em> their logging calls to their parents. In this way, you can\ndefine a single set of handlers at the root of a logger tree, and\ncapture all logging calls in the subtree of loggers. A logging handler\ndefined in the <code class=\"docutils literal notranslate\"><span class=\"pre\">project</span></code> namespace will catch all logging messages\nissued on the <code class=\"docutils literal notranslate\"><span class=\"pre\">project.interesting</span></code> and\n<code class=\"docutils literal notranslate\"><span class=\"pre\">project.interesting.stuff</span></code> loggers.</p>\n<p>This propagation can be controlled on a per-logger basis. If\nyou don’t want a particular logger to propagate to its parents, you\ncan turn off this behavior.</p>\n</section>\n<section id=\"making-logging-calls\">\n<h3>Making logging calls<a class=\"heading-anchor\" href=\"#making-logging-calls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The logger instance contains an entry method for each of the default\nlog levels:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.debug()</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.info()</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.warning()</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.error()</span></code></p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.critical()</span></code></p></li>\n</ul>\n<p>There are two other logging calls available:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.log()</span></code>: Manually emits a logging message with a\nspecific log level.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">logger.exception()</span></code>: Creates an <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> level logging\nmessage wrapping the current exception stack frame.</p></li>\n</ul>\n</section>\n</section>\n<section id=\"configuring-logging\">\n<span id=\"id1\"></span><h2>Configuring logging<a class=\"heading-anchor\" href=\"#configuring-logging\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Of course, it isn’t enough to just put logging calls into your code.\nYou also need to configure the loggers, handlers, filters and\nformatters to ensure that logging output is output in a useful way.</p>\n<p>Python’s logging library provides several techniques to configure\nlogging, ranging from a programmatic interface to configuration files.\nBy default, Django uses the <a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.config.html#logging-config-dictschema\" title=\"(w Python v3.14)\"><span class=\"xref std std-ref\">dictConfig format</span></a>.</p>\n<p>In order to configure logging, you use <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING</span></code></a> to define a\ndictionary of logging settings. These settings describes the loggers,\nhandlers, filters and formatters that you want in your logging setup,\nand the log levels and other properties that you want those components\nto have.</p>\n<p>By default, the <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING</span></code></a> setting is merged with <a class=\"reference internal\" href=\"#default-logging-configuration\"><span class=\"std std-ref\">Django’s\ndefault logging configuration</span></a> using the\nfollowing scheme.</p>\n<p>If the <code class=\"docutils literal notranslate\"><span class=\"pre\">disable_existing_loggers</span></code> key in the <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING</span></code></a> dictConfig is\nset to <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code> (which is the default) then all loggers from the default\nconfiguration will be disabled. Disabled loggers are not the same as removed;\nthe logger will still exist, but will silently discard anything logged to it,\nnot even propagating entries to a parent logger. Thus you should be very\ncareful using <code class=\"docutils literal notranslate\"><span class=\"pre\">'disable_existing_loggers':</span> <span class=\"pre\">True</span></code>; it’s probably not what you\nwant. Instead, you can set <code class=\"docutils literal notranslate\"><span class=\"pre\">disable_existing_loggers</span></code> to <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code> and\nredefine some or all of the default loggers; or you can set\n<a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING_CONFIG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING_CONFIG</span></code></a> to <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code> and <a class=\"reference internal\" href=\"#disabling-logging-configuration\"><span class=\"std std-ref\">handle logging config yourself</span></a>.</p>\n<p>Logging is configured as part of the general Django <code class=\"docutils literal notranslate\"><span class=\"pre\">setup()</span></code> function.\nTherefore, you can be certain that loggers are always ready for use in your\nproject code.</p>\n<section id=\"examples\">\n<h3>Examples<a class=\"heading-anchor\" href=\"#examples\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The full documentation for <a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.config.html#logging-config-dictschema\" title=\"(w Python v3.14)\"><span class=\"xref std std-ref\">dictConfig format</span></a>\nis the best source of information about logging configuration dictionaries.\nHowever, to give you a taste of what is possible, here are several examples.</p>\n<p>First, here’s a simple configuration which writes all logging from the\n<a class=\"reference internal\" href=\"#django-logger\"><span class=\"std std-ref\">django</span></a> logger to a local file:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">LOGGING</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;version&#39;</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;disable_existing_loggers&#39;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;file&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;DEBUG&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;logging.FileHandler&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;filename&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;/path/to/django/debug.log&#39;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n    <span class=\"s1\">&#39;loggers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;django&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;file&#39;</span><span class=\"p\">],</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;DEBUG&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;propagate&#39;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>If you use this example, be sure to change the <code class=\"docutils literal notranslate\"><span class=\"pre\">'filename'</span></code> path to a\nlocation that’s writable by the user that’s running the Django application.</p>\n<p>Second, here’s an example of how to make the logging system print Django’s\nlogging to the console. It may be useful during local development.</p>\n<p>By default, this config only sends messages of level <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code> or higher to the\nconsole (same as Django’s default logging config, except that the default only\ndisplays log records when <code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG=True</span></code>). Django does not log many such\nmessages. With this config, however, you can also set the environment variable\n<code class=\"docutils literal notranslate\"><span class=\"pre\">DJANGO_LOG_LEVEL=DEBUG</span></code> to see all of Django’s debug logging which is very\nverbose as it includes all database queries:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">import</span><span class=\"w\"> </span><span class=\"nn\">os</span>\n\n<span class=\"n\">LOGGING</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;version&#39;</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;disable_existing_loggers&#39;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;console&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;logging.StreamHandler&#39;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n    <span class=\"s1\">&#39;loggers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;django&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;console&#39;</span><span class=\"p\">],</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"n\">os</span><span class=\"o\">.</span><span class=\"n\">getenv</span><span class=\"p\">(</span><span class=\"s1\">&#39;DJANGO_LOG_LEVEL&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;INFO&#39;</span><span class=\"p\">),</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Finally, here’s an example of a fairly complex logging setup:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">LOGGING</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;version&#39;</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;disable_existing_loggers&#39;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;formatters&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;verbose&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;format&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;</span><span class=\"si\">%(levelname)s</span><span class=\"s1\"> </span><span class=\"si\">%(asctime)s</span><span class=\"s1\"> </span><span class=\"si\">%(module)s</span><span class=\"s1\"> </span><span class=\"si\">%(process)d</span><span class=\"s1\"> </span><span class=\"si\">%(thread)d</span><span class=\"s1\"> </span><span class=\"si\">%(message)s</span><span class=\"s1\">&#39;</span>\n        <span class=\"p\">},</span>\n        <span class=\"s1\">&#39;simple&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;format&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;</span><span class=\"si\">%(levelname)s</span><span class=\"s1\"> </span><span class=\"si\">%(message)s</span><span class=\"s1\">&#39;</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n    <span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;special&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;()&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;project.logging.SpecialFilter&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;foo&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;bar&#39;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n        <span class=\"s1\">&#39;require_debug_true&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;()&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.RequireDebugTrue&#39;</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n    <span class=\"p\">},</span>\n    <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;console&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;INFO&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;require_debug_true&#39;</span><span class=\"p\">],</span>\n            <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;logging.StreamHandler&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;formatter&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;simple&#39;</span>\n        <span class=\"p\">},</span>\n        <span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;ERROR&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.AdminEmailHandler&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;special&#39;</span><span class=\"p\">]</span>\n        <span class=\"p\">}</span>\n    <span class=\"p\">},</span>\n    <span class=\"s1\">&#39;loggers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;django&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;console&#39;</span><span class=\"p\">],</span>\n            <span class=\"s1\">&#39;propagate&#39;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n        <span class=\"s1\">&#39;django.request&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">],</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;ERROR&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;propagate&#39;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n        <span class=\"p\">},</span>\n        <span class=\"s1\">&#39;myproject.custom&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n            <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;console&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">],</span>\n            <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;INFO&#39;</span><span class=\"p\">,</span>\n            <span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;special&#39;</span><span class=\"p\">]</span>\n        <span class=\"p\">}</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>This logging configuration does the following things:</p>\n<ul>\n<li><p>Identifies the configuration as being in «dictConfig version 1»\nformat. At present, this is the only dictConfig format version.</p></li>\n<li><p>Defines two formatters:</p>\n<ul>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">simple</span></code>, that just outputs the log level name (e.g.,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code>) and the log message.</p>\n<p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">format</span></code> string is a normal Python formatting string\ndescribing the details that are to be output on each logging\nline. The full list of detail that can be output can be\nfound in <a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.html#formatter-objects\" title=\"(w Python v3.14)\"><span>Formatter Objects</span></a>.</p>\n</li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">verbose</span></code>, that outputs the log level name, the log\nmessage, plus the time, process, thread and module that\ngenerate the log message.</p></li>\n</ul>\n</li>\n<li><p>Defines two filters:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">project.logging.SpecialFilter</span></code>, using the alias <code class=\"docutils literal notranslate\"><span class=\"pre\">special</span></code>. If this\nfilter required additional arguments, they can be provided as additional\nkeys in the filter configuration dictionary. In this case, the argument\n<code class=\"docutils literal notranslate\"><span class=\"pre\">foo</span></code> will be given a value of <code class=\"docutils literal notranslate\"><span class=\"pre\">bar</span></code> when instantiating\n<code class=\"docutils literal notranslate\"><span class=\"pre\">SpecialFilter</span></code>.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">django.utils.log.RequireDebugTrue</span></code>, which passes on records when\n<a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> is <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code>.</p></li>\n</ul>\n</li>\n<li><p>Defines two handlers:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">console</span></code>, a StreamHandler, which will print any <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code>\n(or higher) message to stderr. This handler uses the <code class=\"docutils literal notranslate\"><span class=\"pre\">simple</span></code> output\nformat.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">mail_admins</span></code>, an AdminEmailHandler, which will email any\n<code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> (or higher) message to the site admins. This handler uses\nthe <code class=\"docutils literal notranslate\"><span class=\"pre\">special</span></code> filter.</p></li>\n</ul>\n</li>\n<li><p>Configures three loggers:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code>, which passes all messages to the <code class=\"docutils literal notranslate\"><span class=\"pre\">console</span></code> handler.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">django.request</span></code>, which passes all <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> messages to\nthe <code class=\"docutils literal notranslate\"><span class=\"pre\">mail_admins</span></code> handler. In addition, this logger is\nmarked to <em>not</em> propagate messages. This means that log\nmessages written to <code class=\"docutils literal notranslate\"><span class=\"pre\">django.request</span></code> will not be handled\nby the <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> logger.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">myproject.custom</span></code>, which passes all messages at <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code>\nor higher that also pass the <code class=\"docutils literal notranslate\"><span class=\"pre\">special</span></code> filter to two\nhandlers – the <code class=\"docutils literal notranslate\"><span class=\"pre\">console</span></code>, and <code class=\"docutils literal notranslate\"><span class=\"pre\">mail_admins</span></code>. This\nmeans that all <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code> level messages (or higher) will be\nprinted to the console; <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">CRITICAL</span></code>\nmessages will also be output via email.</p></li>\n</ul>\n</li>\n</ul>\n</section>\n<section id=\"custom-logging-configuration\">\n<h3>Custom logging configuration<a class=\"heading-anchor\" href=\"#custom-logging-configuration\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you don’t want to use Python’s dictConfig format to configure your\nlogger, you can specify your own configuration scheme.</p>\n<p>The <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING_CONFIG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING_CONFIG</span></code></a> setting defines the callable that will\nbe used to configure Django’s loggers. By default, it points at\nPython’s <a class=\"reference external\" href=\"https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig\" title=\"(w Python v3.14)\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">logging.config.dictConfig()</span></code></a> function. However, if you want to\nuse a different configuration process, you can use any other callable\nthat takes a single argument. The contents of <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING</span></code></a> will\nbe provided as the value of that argument when logging is configured.</p>\n</section>\n<section id=\"disabling-logging-configuration\">\n<span id=\"id2\"></span><h3>Disabling logging configuration<a class=\"heading-anchor\" href=\"#disabling-logging-configuration\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you don’t want to configure logging at all (or you want to manually\nconfigure logging using your own approach), you can set\n<a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING_CONFIG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING_CONFIG</span></code></a> to <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code>. This will disable the\nconfiguration process for <a class=\"reference internal\" href=\"#default-logging-configuration\"><span class=\"std std-ref\">Django’s default logging</span></a>. Here’s an example that disables Django’s\nlogging configuration and then manually configures logging:</p>\n<figure class=\"code-block code-block-captioned\" data-language=\"default\"><figcaption class=\"code-block-caption\"><code>settings.py</code></figcaption><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"settings.py\"><code><span class=\"n\">LOGGING_CONFIG</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>\n\n<span class=\"kn\">import</span><span class=\"w\"> </span><span class=\"nn\">logging.config</span>\n<span class=\"n\">logging</span><span class=\"o\">.</span><span class=\"n\">config</span><span class=\"o\">.</span><span class=\"n\">dictConfig</span><span class=\"p\">(</span><span class=\"o\">...</span><span class=\"p\">)</span>\n</code></pre></figure>\n<p>Setting <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING_CONFIG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING_CONFIG</span></code></a> to <code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code> only means that the automatic\nconfiguration process is disabled, not logging itself. If you disable the\nconfiguration process, Django will still make logging calls, falling back to\nwhatever default logging behavior is defined.</p>\n</section>\n</section>\n<section id=\"django-s-logging-extensions\">\n<h2>Django’s logging extensions<a class=\"heading-anchor\" href=\"#django-s-logging-extensions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django provides a number of utilities to handle the unique\nrequirements of logging in Web server environment.</p>\n<section id=\"id3\">\n<h3>Loggers<a class=\"heading-anchor\" href=\"#id3\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django provides several built-in loggers.</p>\n<section id=\"django\">\n<span id=\"django-logger\"></span><h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code><a class=\"heading-anchor\" href=\"#django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The catch-all logger for messages in the  <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> hierarchy. No messages are\nposted using this name but instead using one of the loggers below.</p>\n</section>\n<section id=\"django-request\">\n<span id=\"django-request-logger\"></span><h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django.request</span></code><a class=\"heading-anchor\" href=\"#django-request\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Log messages related to the handling of requests. 5XX responses are\nraised as <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> messages; 4XX responses are raised as <code class=\"docutils literal notranslate\"><span class=\"pre\">WARNING</span></code>\nmessages.</p>\n<p>Messages to this logger have the following extra context:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">status_code</span></code>: The HTTP response code associated with the\nrequest.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">request</span></code>: The request object that generated the logging\nmessage.</p></li>\n</ul>\n</section>\n<section id=\"django-server\">\n<span id=\"django-server-logger\"></span><h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django.server</span></code><a class=\"heading-anchor\" href=\"#django-server\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<aside class=\"version-note version-added\" data-version=\"1.10\">\n<p class=\"version-note-title\">New in Django 1.10</p></aside>\n<p>Log messages related to the handling of requests received by the server invoked\nby the <a class=\"reference internal\" href=\"/pl/1.11/ref/django-admin/#django-admin-runserver\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">runserver</span></code></a> command. HTTP 5XX responses are logged as <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code>\nmessages, 4XX responses are logged as <code class=\"docutils literal notranslate\"><span class=\"pre\">WARNING</span></code> messages, and everything else\nis logged as <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code>.</p>\n<p>Messages to this logger have the following extra context:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">status_code</span></code>: The HTTP response code associated with the request.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">request</span></code>: The request object that generated the logging message.</p></li>\n</ul>\n</section>\n<section id=\"django-template\">\n<span id=\"django-template-logger\"></span><h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django.template</span></code><a class=\"heading-anchor\" href=\"#django-template\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Log messages related to the rendering of templates.</p>\n<ul class=\"simple\">\n<li><p>Missing context variables are logged as <code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code> messages.</p></li>\n<li><p>Uncaught exceptions raised during the rendering of an\n<a class=\"reference internal\" href=\"/pl/1.11/ref/templates/builtins/#std-templatetag-include\"><code class=\"xref std std-ttag docutils literal notranslate\"><span class=\"pre\">{%</span> <span class=\"pre\">include</span> <span class=\"pre\">%}</span></code></a> are logged as <code class=\"docutils literal notranslate\"><span class=\"pre\">WARNING</span></code> messages when\ndebug mode is off (helpful since <code class=\"docutils literal notranslate\"><span class=\"pre\">{%</span> <span class=\"pre\">include</span> <span class=\"pre\">%}</span></code> silences the exception and\nreturns an empty string in that case).</p></li>\n</ul>\n</section>\n<section id=\"django-db-backends\">\n<span id=\"django-db-logger\"></span><h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django.db.backends</span></code><a class=\"heading-anchor\" href=\"#django-db-backends\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Messages relating to the interaction of code with the database. For example,\nevery application-level SQL statement executed by a request is logged at the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code> level to this logger.</p>\n<p>Messages to this logger have the following extra context:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">duration</span></code>: The time taken to execute the SQL statement.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">sql</span></code>: The SQL statement that was executed.</p></li>\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">params</span></code>: The parameters that were used in the SQL call.</p></li>\n</ul>\n<p>For performance reasons, SQL logging is only enabled when\n<code class=\"docutils literal notranslate\"><span class=\"pre\">settings.DEBUG</span></code> is set to <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code>, regardless of the logging\nlevel or handlers that are installed.</p>\n<p>This logging does not include framework-level initialization (e.g.\n<code class=\"docutils literal notranslate\"><span class=\"pre\">SET</span> <span class=\"pre\">TIMEZONE</span></code>) or transaction management queries (e.g. <code class=\"docutils literal notranslate\"><span class=\"pre\">BEGIN</span></code>,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">COMMIT</span></code>, and <code class=\"docutils literal notranslate\"><span class=\"pre\">ROLLBACK</span></code>). Turn on query logging in your database if you\nwish to view all database queries.</p>\n</section>\n<section id=\"django-security\">\n<span id=\"django-security-logger\"></span><h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django.security.*</span></code><a class=\"heading-anchor\" href=\"#django-security\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>The security loggers will receive messages on any occurrence of\n<a class=\"reference internal\" href=\"/pl/1.11/ref/exceptions/#django.core.exceptions.SuspiciousOperation\" title=\"django.core.exceptions.SuspiciousOperation\"><code class=\"xref py py-exc docutils literal notranslate\"><span class=\"pre\">SuspiciousOperation</span></code></a> and other security-related\nerrors. There is a sub-logger for each subtype of security error, including all\n<code class=\"docutils literal notranslate\"><span class=\"pre\">SuspiciousOperation</span></code>s. The level of the log event depends on where the\nexception is handled.  Most occurrences are logged as a warning, while\nany <code class=\"docutils literal notranslate\"><span class=\"pre\">SuspiciousOperation</span></code> that reaches the WSGI handler will be logged as an\nerror. For example, when an HTTP <code class=\"docutils literal notranslate\"><span class=\"pre\">Host</span></code> header is included in a request from\na client that does not match <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-ALLOWED_HOSTS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">ALLOWED_HOSTS</span></code></a>, Django will return a 400\nresponse, and an error message will be logged to the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django.security.DisallowedHost</span></code> logger.</p>\n<p>These log events will reach the <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> logger by default, which mails error\nevents to admins when <code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG=False</span></code>. Requests resulting in a 400 response due\nto a <code class=\"docutils literal notranslate\"><span class=\"pre\">SuspiciousOperation</span></code> will not be logged to the <code class=\"docutils literal notranslate\"><span class=\"pre\">django.request</span></code>\nlogger, but only to the <code class=\"docutils literal notranslate\"><span class=\"pre\">django.security</span></code> logger.</p>\n<p>To silence a particular type of <code class=\"docutils literal notranslate\"><span class=\"pre\">SuspiciousOperation</span></code>, you can override that\nspecific logger following this example:</p>\n<div class=\"code-block\" data-language=\"python\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;null&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;logging.NullHandler&#39;</span><span class=\"p\">,</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">},</span>\n<span class=\"s1\">&#39;loggers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;django.security.DisallowedHost&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;null&#39;</span><span class=\"p\">],</span>\n        <span class=\"s1\">&#39;propagate&#39;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">,</span>\n    <span class=\"p\">},</span>\n<span class=\"p\">},</span>\n</code></pre></div>\n<p>Other <code class=\"docutils literal notranslate\"><span class=\"pre\">django.security</span></code> loggers not based on <code class=\"docutils literal notranslate\"><span class=\"pre\">SuspiciousOperation</span></code> are:</p>\n<ul class=\"simple\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">django.security.csrf</span></code>: For <a class=\"reference internal\" href=\"/pl/1.11/ref/csrf/#csrf-rejected-requests\"><span class=\"std std-ref\">CSRF failures</span></a>.</p></li>\n</ul>\n</section>\n<section id=\"django-db-backends-schema\">\n<h4><code class=\"docutils literal notranslate\"><span class=\"pre\">django.db.backends.schema</span></code><a class=\"heading-anchor\" href=\"#django-db-backends-schema\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Logs the SQL queries that are executed during schema changes to the database by\nthe <a class=\"reference internal\" href=\"/pl/1.11/topics/migrations/\"><span class=\"doc\">migrations framework</span></a>. Note that it won’t log the\nqueries executed by <a class=\"reference internal\" href=\"/pl/1.11/ref/migration-operations/#django.db.migrations.operations.RunPython\" title=\"django.db.migrations.operations.RunPython\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">RunPython</span></code></a>.\nMessages to this logger have <code class=\"docutils literal notranslate\"><span class=\"pre\">params</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">sql</span></code> in their extra context (but\nunlike <code class=\"docutils literal notranslate\"><span class=\"pre\">django.db.backends</span></code>, not duration). The values have the same meaning\nas explained in <a class=\"reference internal\" href=\"#django-db-logger\"><span class=\"std std-ref\">django.db.backends</span></a>.</p>\n<aside class=\"version-note version-added\" data-version=\"1.10\">\n<p class=\"version-note-title\">New in Django 1.10</p><p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">extra</span></code> context was added.</p>\n</aside>\n</section>\n</section>\n<section id=\"id4\">\n<h3>Handlers<a class=\"heading-anchor\" href=\"#id4\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django provides one log handler in addition to those provided by the\nPython logging module.</p>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.utils.log.AdminEmailHandler\">\n<em class=\"property\"><span class=\"k\"><span class=\"pre\">class</span></span><span class=\"w\"> </span></em><span class=\"sig-name descname\"><span class=\"pre\">AdminEmailHandler</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">include_html</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">False</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">email_backend</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">None</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.utils.log.AdminEmailHandler\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This handler sends an email to the site admins for each log\nmessage it receives.</p>\n<p>If the log record contains a <code class=\"docutils literal notranslate\"><span class=\"pre\">request</span></code> attribute, the full details\nof the request will be included in the email. The email subject will\ninclude the phrase „internal IP” if the client’s IP address is in the\n<a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-INTERNAL_IPS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">INTERNAL_IPS</span></code></a> setting; if not, it will include „EXTERNAL IP”.</p>\n<p>If the log record contains stack trace information, that stack\ntrace will be included in the email.</p>\n<p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">include_html</span></code> argument of <code class=\"docutils literal notranslate\"><span class=\"pre\">AdminEmailHandler</span></code> is used to\ncontrol whether the traceback email includes an HTML attachment\ncontaining the full content of the debug Web page that would have been\nproduced if <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> were <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code>. To set this value in your\nconfiguration, include it in the handler definition for\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django.utils.log.AdminEmailHandler</span></code>, like this:</p>\n<div class=\"code-block\" data-language=\"python\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;ERROR&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.AdminEmailHandler&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;include_html&#39;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">},</span>\n</code></pre></div>\n<p>Note that this HTML version of the email contains a full traceback,\nwith names and values of local variables at each level of the stack, plus\nthe values of your Django settings. This information is potentially very\nsensitive, and you may not want to send it over email. Consider using\nsomething such as <a class=\"reference external\" href=\"https://pypi.python.org/pypi/sentry\">Sentry</a> to get the best of both worlds – the\nrich information of full tracebacks plus the security of <em>not</em> sending the\ninformation over email. You may also explicitly designate certain\nsensitive information to be filtered out of error reports – learn more on\n<a class=\"reference internal\" href=\"/pl/1.11/howto/error-reporting/#filtering-error-reports\"><span class=\"std std-ref\">Filtering error reports</span></a>.</p>\n<p>By setting the <code class=\"docutils literal notranslate\"><span class=\"pre\">email_backend</span></code> argument of <code class=\"docutils literal notranslate\"><span class=\"pre\">AdminEmailHandler</span></code>, the\n<a class=\"reference internal\" href=\"/pl/1.11/topics/email/#topic-email-backends\"><span class=\"std std-ref\">email backend</span></a> that is being used by the\nhandler can be overridden, like this:</p>\n<div class=\"code-block\" data-language=\"python\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;ERROR&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.AdminEmailHandler&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;email_backend&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.core.mail.backends.filebased.EmailBackend&#39;</span><span class=\"p\">,</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">},</span>\n</code></pre></div>\n<p>By default, an instance of the email backend specified in\n<a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-EMAIL_BACKEND\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">EMAIL_BACKEND</span></code></a> will be used.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.utils.log.AdminEmailHandler.send_mail\">\n<span class=\"sig-name descname\"><span class=\"pre\">send_mail</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">subject</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">message</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">*</span></span><span class=\"n\"><span class=\"pre\">args</span></span></em>, <em class=\"sig-param\"><span class=\"o\"><span class=\"pre\">**</span></span><span class=\"n\"><span class=\"pre\">kwargs</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.utils.log.AdminEmailHandler.send_mail\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Sends emails to admin users. To customize this behavior, you can\nsubclass the <a class=\"reference internal\" href=\"#django.utils.log.AdminEmailHandler\" title=\"django.utils.log.AdminEmailHandler\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">AdminEmailHandler</span></code></a> class and\noverride this method.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"id5\">\n<h3>Filtry<a class=\"heading-anchor\" href=\"#id5\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django provides two log filters in addition to those provided by the Python\nlogging module.</p>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.utils.log.CallbackFilter\">\n<em class=\"property\"><span class=\"k\"><span class=\"pre\">class</span></span><span class=\"w\"> </span></em><span class=\"sig-name descname\"><span class=\"pre\">CallbackFilter</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">callback</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.utils.log.CallbackFilter\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This filter accepts a callback function (which should accept a single\nargument, the record to be logged), and calls it for each record that\npasses through the filter. Handling of that record will not proceed if the\ncallback returns False.</p>\n<p>For instance, to filter out <a class=\"reference internal\" href=\"/pl/1.11/ref/exceptions/#django.http.UnreadablePostError\" title=\"django.http.UnreadablePostError\"><code class=\"xref py py-exc docutils literal notranslate\"><span class=\"pre\">UnreadablePostError</span></code></a>\n(raised when a user cancels an upload) from the admin emails, you would\ncreate a filter function:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.http</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">UnreadablePostError</span>\n\n<span class=\"k\">def</span><span class=\"w\"> </span><span class=\"nf\">skip_unreadable_post</span><span class=\"p\">(</span><span class=\"n\">record</span><span class=\"p\">):</span>\n    <span class=\"k\">if</span> <span class=\"n\">record</span><span class=\"o\">.</span><span class=\"n\">exc_info</span><span class=\"p\">:</span>\n        <span class=\"n\">exc_type</span><span class=\"p\">,</span> <span class=\"n\">exc_value</span> <span class=\"o\">=</span> <span class=\"n\">record</span><span class=\"o\">.</span><span class=\"n\">exc_info</span><span class=\"p\">[:</span><span class=\"mi\">2</span><span class=\"p\">]</span>\n        <span class=\"k\">if</span> <span class=\"nb\">isinstance</span><span class=\"p\">(</span><span class=\"n\">exc_value</span><span class=\"p\">,</span> <span class=\"n\">UnreadablePostError</span><span class=\"p\">):</span>\n            <span class=\"k\">return</span> <span class=\"kc\">False</span>\n    <span class=\"k\">return</span> <span class=\"kc\">True</span>\n</code></pre></div>\n<p>and then add it to your logging config:</p>\n<div class=\"code-block\" data-language=\"python\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;skip_unreadable_posts&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;()&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.CallbackFilter&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;callback&#39;</span><span class=\"p\">:</span> <span class=\"n\">skip_unreadable_post</span><span class=\"p\">,</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">},</span>\n<span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;ERROR&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;skip_unreadable_posts&#39;</span><span class=\"p\">],</span>\n        <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.AdminEmailHandler&#39;</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">},</span>\n</code></pre></div>\n</dd></dl>\n\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.utils.log.RequireDebugFalse\">\n<em class=\"property\"><span class=\"k\"><span class=\"pre\">class</span></span><span class=\"w\"> </span></em><span class=\"sig-name descname\"><span class=\"pre\">RequireDebugFalse</span></span><a class=\"heading-anchor\" href=\"#django.utils.log.RequireDebugFalse\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This filter will only pass on records when settings.DEBUG is False.</p>\n<p>This filter is used as follows in the default <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-LOGGING\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">LOGGING</span></code></a>\nconfiguration to ensure that the <a class=\"reference internal\" href=\"#django.utils.log.AdminEmailHandler\" title=\"django.utils.log.AdminEmailHandler\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">AdminEmailHandler</span></code></a> only sends\nerror emails to admins when <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> is <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code>:</p>\n<div class=\"code-block\" data-language=\"python\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;require_debug_false&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;()&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.RequireDebugFalse&#39;</span><span class=\"p\">,</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">},</span>\n<span class=\"s1\">&#39;handlers&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n    <span class=\"s1\">&#39;mail_admins&#39;</span><span class=\"p\">:</span> <span class=\"p\">{</span>\n        <span class=\"s1\">&#39;level&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;ERROR&#39;</span><span class=\"p\">,</span>\n        <span class=\"s1\">&#39;filters&#39;</span><span class=\"p\">:</span> <span class=\"p\">[</span><span class=\"s1\">&#39;require_debug_false&#39;</span><span class=\"p\">],</span>\n        <span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;django.utils.log.AdminEmailHandler&#39;</span>\n    <span class=\"p\">}</span>\n<span class=\"p\">},</span>\n</code></pre></div>\n</dd></dl>\n\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.utils.log.RequireDebugTrue\">\n<em class=\"property\"><span class=\"k\"><span class=\"pre\">class</span></span><span class=\"w\"> </span></em><span class=\"sig-name descname\"><span class=\"pre\">RequireDebugTrue</span></span><a class=\"heading-anchor\" href=\"#django.utils.log.RequireDebugTrue\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This filter is similar to <a class=\"reference internal\" href=\"#django.utils.log.RequireDebugFalse\" title=\"django.utils.log.RequireDebugFalse\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">RequireDebugFalse</span></code></a>, except that records are\npassed only when <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> is <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code>.</p>\n</dd></dl>\n\n</section>\n</section>\n<section id=\"django-s-default-logging-configuration\">\n<span id=\"default-logging-configuration\"></span><h2>Django’s default logging configuration<a class=\"heading-anchor\" href=\"#django-s-default-logging-configuration\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>By default, Django configures the following logging:</p>\n<p>When <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> is <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code>:</p>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> logger sends messages in the <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> hierarchy (except\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django.server</span></code>) at the <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code> level or higher to the console.</p></li>\n</ul>\n<p>When <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> is <code class=\"docutils literal notranslate\"><span class=\"pre\">False</span></code>:</p>\n<ul class=\"simple\">\n<li><p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> logger sends messages in the <code class=\"docutils literal notranslate\"><span class=\"pre\">django</span></code> hierarchy (except\n<code class=\"docutils literal notranslate\"><span class=\"pre\">django.server</span></code>)  with <code class=\"docutils literal notranslate\"><span class=\"pre\">ERROR</span></code> or <code class=\"docutils literal notranslate\"><span class=\"pre\">CRITICAL</span></code> level to\n<a class=\"reference internal\" href=\"#django.utils.log.AdminEmailHandler\" title=\"django.utils.log.AdminEmailHandler\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">AdminEmailHandler</span></code></a>.</p></li>\n</ul>\n<p>Independent of the value of <a class=\"reference internal\" href=\"/pl/1.11/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a>:</p>\n<ul class=\"simple\">\n<li><p>The <a class=\"reference internal\" href=\"#django-server-logger\"><span class=\"std std-ref\">django.server</span></a> logger sends messages at the <code class=\"docutils literal notranslate\"><span class=\"pre\">INFO</span></code> level\nor higher to the console.</p></li>\n</ul>\n<p>See also <a class=\"reference internal\" href=\"#configuring-logging\"><span class=\"std std-ref\">Configuring logging</span></a> to learn how you can\ncomplement or replace this default logging configuration.</p>\n</section>","rootId":"module-django.utils.log","toc":[{"title":"A quick logging primer","anchor":"a-quick-logging-primer","children":[{"title":"The cast of players","anchor":"the-cast-of-players","children":[{"title":"Loggers","anchor":"loggers","children":[]},{"title":"Handlers","anchor":"handlers","children":[]},{"title":"Filtry","anchor":"filters","children":[]},{"title":"Formatters","anchor":"formatters","children":[]}]}]},{"title":"Using logging","anchor":"using-logging","children":[{"title":"Naming loggers","anchor":"naming-loggers","children":[]},{"title":"Making logging calls","anchor":"making-logging-calls","children":[]}]},{"title":"Configuring logging","anchor":"configuring-logging","children":[{"title":"Examples","anchor":"examples","children":[]},{"title":"Custom logging configuration","anchor":"custom-logging-configuration","children":[]},{"title":"Disabling logging configuration","anchor":"disabling-logging-configuration","children":[]}]},{"title":"Django’s logging extensions","anchor":"django-s-logging-extensions","children":[{"title":"Loggers","anchor":"id3","children":[{"title":"django","anchor":"django","children":[]},{"title":"django.request","anchor":"django-request","children":[]},{"title":"django.server","anchor":"django-server","children":[]},{"title":"django.template","anchor":"django-template","children":[]},{"title":"django.db.backends","anchor":"django-db-backends","children":[]},{"title":"django.security.*","anchor":"django-security","children":[]},{"title":"django.db.backends.schema","anchor":"django-db-backends-schema","children":[]}]},{"title":"Handlers","anchor":"id4","children":[]},{"title":"Filtry","anchor":"id5","children":[]}]},{"title":"Django’s default logging configuration","anchor":"django-s-default-logging-configuration","children":[]}],"breadcrumbs":[{"docname":"topics/index","title":"Używanie Django","url":"/pl/1.11/topics/"}],"prev":{"docname":"topics/i18n/timezones","title":"Time zones","url":"/pl/1.11/topics/i18n/timezones/"},"next":{"docname":"topics/pagination","title":"Stronicowanie","url":"/pl/1.11/topics/pagination/"},"formats":{"html":"/pl/1.11/topics/logging/","markdown":"/pl/1.11/topics/logging.md","json":"/pl/1.11/topics/logging.json"},"source":"https://github.com/django/django/blob/stable/1.11.x/docs/topics/logging.txt","official":"https://docs.djangoproject.com/pl/1.11/topics/logging/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10"],"inLocales":["en","fr","ja","id","pt-br","ko","es","el","pl"]}