Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
90b64db3
Kaydet (Commit)
90b64db3
authored
Agu 15, 2014
tarafından
areski
Kaydeden (comit)
Tim Graham
Agu 15, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed syntax highlighting and indentation in docs/topics/logging.txt.
üst
7ca665c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
30 deletions
+41
-30
logging.txt
docs/topics/logging.txt
+41
-30
No files found.
docs/topics/logging.txt
Dosyayı görüntüle @
90b64db3
...
@@ -481,13 +481,16 @@ a ``SuspiciousOperation`` will not be logged to the ``django.request`` logger,
...
@@ -481,13 +481,16 @@ a ``SuspiciousOperation`` will not be logged to the ``django.request`` logger,
but only to the ``django.security`` logger.
but only to the ``django.security`` logger.
To silence a particular type of SuspiciousOperation, you can override that
To silence a particular type of SuspiciousOperation, you can override that
specific logger following this example:
:
specific logger following this example:
'loggers': {
.. code-block:: python
'django.security.DisallowedHost': {
'handlers': ['null'],
'loggers': {
'propagate': False,
'django.security.DisallowedHost': {
},
'handlers': ['null'],
'propagate': False,
},
},
``django.db.backends.schema``
``django.db.backends.schema``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
@@ -520,7 +523,9 @@ Python logging module.
...
@@ -520,7 +523,9 @@ Python logging module.
containing the full content of the debug Web page that would have been
containing the full content of the debug Web page that would have been
produced if :setting:`DEBUG` were ``True``. To set this value in your
produced if :setting:`DEBUG` were ``True``. To set this value in your
configuration, include it in the handler definition for
configuration, include it in the handler definition for
``django.utils.log.AdminEmailHandler``, like this::
``django.utils.log.AdminEmailHandler``, like this:
.. code-block:: python
'handlers': {
'handlers': {
'mail_admins': {
'mail_admins': {
...
@@ -542,7 +547,9 @@ Python logging module.
...
@@ -542,7 +547,9 @@ Python logging module.
By setting the ``email_backend`` argument of ``AdminEmailHandler``, the
By setting the ``email_backend`` argument of ``AdminEmailHandler``, the
:ref:`email backend <topic-email-backends>` that is being used by the
:ref:`email backend <topic-email-backends>` that is being used by the
handler can be overridden, like this::
handler can be overridden, like this:
.. code-block:: python
'handlers': {
'handlers': {
'mail_admins': {
'mail_admins': {
...
@@ -566,25 +573,27 @@ logging module.
...
@@ -566,25 +573,27 @@ logging module.
.. class:: CallbackFilter(callback)
.. class:: CallbackFilter(callback)
This filter accepts a callback function (which should accept a single
This filter accepts a callback function (which should accept a single
argument, the record to be logged), and calls it for each record that passes
argument, the record to be logged), and calls it for each record that
through the filter. Handling of that record will not proceed if the callback
passes through the filter. Handling of that record will not proceed if the
returns False.
callback returns False.
For instance, to filter out :exc:`~django.http.UnreadablePostError`
(raised when a user cancels an upload) from the admin emails, you would
create a filter function::
For instance, to filter out :exc:`~django.http.UnreadablePostError`
from django.http import UnreadablePostError
(raised when a user cancels an upload) from the admin emails, you would
create a filter function::
from django.http import UnreadablePostError
def skip_unreadable_post(record):
if record.exc_info:
exc_type, exc_value = record.exc_info[:2]
if isinstance(exc_value, UnreadablePostError):
return False
return True
def skip_unreadable_post(record):
and then add it to your logging config:
if record.exc_info:
exc_type, exc_value = record.exc_info[:2]
if isinstance(exc_value, UnreadablePostError):
return False
return True
and then add it to your logging config::
.. code-block:: python
'filters': {
'filters': {
'skip_unreadable_posts': {
'skip_unreadable_posts': {
...
@@ -602,13 +611,15 @@ logging module.
...
@@ -602,13 +611,15 @@ logging module.
.. class:: RequireDebugFalse()
.. class:: RequireDebugFalse()
This filter will only pass on records when settings.DEBUG is False.
This filter will only pass on records when settings.DEBUG is False.
This filter is used as follows in the default :setting:`LOGGING`
This filter is used as follows in the default :setting:`LOGGING`
configuration to ensure that the :class:`AdminEmailHandler` only sends error
configuration to ensure that the :class:`AdminEmailHandler` only sends
emails to admins when :setting:`DEBUG` is ``False``:
:
error emails to admins when :setting:`DEBUG` is ``False``
:
'filters': {
.. code-block:: python
'filters': {
'require_debug_false': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
'()': 'django.utils.log.RequireDebugFalse',
}
}
...
@@ -623,8 +634,8 @@ logging module.
...
@@ -623,8 +634,8 @@ logging module.
.. class:: RequireDebugTrue()
.. class:: RequireDebugTrue()
This filter is similar to :class:`RequireDebugFalse`, except that records are
This filter is similar to :class:`RequireDebugFalse`, except that records are
passed only when :setting:`DEBUG` is ``True``.
passed only when :setting:`DEBUG` is ``True``.
.. _default-logging-configuration:
.. _default-logging-configuration:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment